You are here

function apachesolr_search_pager_default_initialize in Apache Solr Search 6.3

Backport of pager_default_initialize from Drupal 7.

1 call to apachesolr_search_pager_default_initialize()
apachesolr_search_process_response in ./apachesolr_search.module
@todo Make sure the paging works for Drupal 6

File

./apachesolr_search.module, line 1868
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_pager_default_initialize($total, $limit, $element = 0) {
  global $pager_page_array, $pager_total, $pager_total_items, $pager_limits;
  $page = apachesolr_search_pager_find_page($element);

  // We calculate the total of pages as ceil(items / limit).
  $pager_total_items[$element] = $total;
  $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
  $pager_page_array[$element] = max(0, min($page, (int) $pager_total[$element] - 1));
  $pager_limits[$element] = $limit;
  return $pager_page_array[$element];
}