You are here

protected function Pager::setTotalPages in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Pager/Pager.php \Drupal\Core\Pager\Pager::setTotalPages()
  2. 10 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.

1 call to Pager::setTotalPages()
Pager::__construct in core/lib/Drupal/Core/Pager/Pager.php
Pager constructor.

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);
}