protected function Pager::setCurrentPage in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setCurrentPage()
- 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\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.
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));
}