• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/dbresult.php
  • Класс: CAllDBResult
  • Вызов: CAllDBResult::DBNavStart
function DBNavStart()
{
	global $DB;

	//total rows count
	if (($count = $this->GetRowsCount()) !== null)
	{
		$this->NavRecordCount = $count;
	}
	else
	{
		return;
	}

	if ($this->NavRecordCount < 1)
	{
		return;
	}

	if ($this->NavShowAll)
	{
		$this->NavPageSize = $this->NavRecordCount;
	}

	//calculate total pages depend on rows count. start with 1
	$this->NavPageCount = floor($this->NavRecordCount / $this->NavPageSize);
	if ($this->NavRecordCount % $this->NavPageSize > 0)
	{
		$this->NavPageCount++;
	}

	//page number to display. start with 1
	$this->calculatePageNumber();

	//rows to skip
	$NavFirstRecordShow = $this->NavPageSize * ($this->NavPageNomer - 1);
	$NavLastRecordShow = $this->NavPageSize * $this->NavPageNomer;

	if ($this->SqlTraceIndex)
	{
		$start_time = microtime(true);
	}

	$this->Seek($NavFirstRecordShow);

	$this->arResult = [];
	for ($i = $NavFirstRecordShow; $i < $NavLastRecordShow; $i++)
	{
		if (($res = $this->FetchInternal()))
		{
			$this->arResult[] = $res;
		}
		else
		{
			break;
		}
	}

	if ($this->SqlTraceIndex)
	{
		/** @noinspection PhpUndefinedVariableInspection */
		$exec_time = round(microtime(true) - $start_time, 10);
		$DB->addDebugTime($this->SqlTraceIndex, $exec_time);
		$DB->timeQuery += $exec_time;
	}
}