• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/dbresult.php
  • Класс: CAllDBResult
  • Вызов: CAllDBResult::calculatePageNumber
protected function calculatePageNumber(int $defaultNumber = 1, bool $useSession = true, bool $checkOutOfRange = false)
{
	$application = MainApplication::getInstance();

	$correct = false;
	if ($this->PAGEN > 0 && $this->PAGEN <= $this->NavPageCount)
	{
		$this->NavPageNomer = $this->PAGEN;
		$correct = true;
	}
	elseif ($useSession && $this->SESS_PAGEN && $application->getKernelSession()->isStarted())
	{
		$localStorage = $application->getLocalSession('navigation');
		$session = $localStorage->getData();

		if ($session[$this->SESS_PAGEN] > 0 && $session[$this->SESS_PAGEN] <= $this->NavPageCount)
		{
			$this->NavPageNomer = $session[$this->SESS_PAGEN];
			$correct = true;
		}
	}

	if (!$correct)
	{
		if ($checkOutOfRange !== true)
		{
			$this->NavPageNomer = $defaultNumber;
		}
		else
		{
			$this->NavPageNomer = null;
		}
	}
}