pager_default_initialize

function pager_default_initialize

pager_default_initialize($total, $limit, $element = 0)

Initializes a pager.

This function sets up the necessary global variables so that the render system will correctly process #type 'pager' render arrays to output pagers that correspond to the items being displayed.

If the items being displayed result from a database query performed using Drupal's database API, and if you have control over the construction of the database query, you do not need to call this function directly; instead, you can simply extend the query object with the 'PagerSelectExtender' extender before executing it. For example:

  $query = db_select('some_table')
    ->extend('Drupal\Core\Database\Query\PagerSelectExtender');

However, if you are using a different method for generating the items to be paged through, then you should call this function in