You are here

protected function Pager::setTotalPages in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()
  2. 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()

Sets the total number of pages.

Parameters

int $totalItems: The total number of items.

int $limit: The maximum number of items per page.

File

core/lib/Drupal/Core/Pager/Pager.php, line 77

Class

Pager
A value object that represents a pager.

Namespace

Drupal\Core\Pager

Code

protected function setTotalPages($totalItems, $limit) {
  $this->totalPages = (int) ceil($totalItems / $limit);
}