function Pager::setCurrentPage
Sets the current page to a valid value within range.
If a page that does not correspond to the actual range of the result set was provided, this function will set the closest page actually within the result set.
Parameters
int $currentPage: (optional) The current page.
1 call to Pager::setCurrentPage()
- Pager::__construct in core/
lib/ Drupal/ Core/ Pager/ Pager.php - Pager constructor.
File
-
core/
lib/ Drupal/ Core/ Pager/ Pager.php, line 65
Class
- Pager
- A value object that represents a pager.
Namespace
Drupal\Core\PagerCode
protected function setCurrentPage($currentPage = 0) {
$this->currentPage = max(0, min($currentPage, $this->getTotalPages() - 1));
}