You are here

function google_appliance_configure_pager in Google Search Appliance 6.2

Configure the Drupal pager. We're not using pager_query(), so we need to do this manually.

Parameters

$total_results: The total number of search results found.

$page: Which page are we viewing? $page = isset($_GET['page']) ? $_GET['page'] : '';

$limit: Number of results per page

$element: Which pager are we using? @see theme_pager()

1 call to google_appliance_configure_pager()
_google_appliance_search in ./google_appliance.module
Perform the search

File

./google_appliance.module, line 1055
Google Search Appliance (GSA) / Google Mini integration

Code

function google_appliance_configure_pager($total_results, $page = NULL, $limit = NULL, $element = 0) {
  global $pager_page_array, $pager_total, $pager_total_items;
  if (is_null($page)) {
    $page = isset($_GET['page']) ? $_GET['page'] : '';
  }
  if (is_null($limit)) {
    $limit = variable_get('google_appliance_limit_per_page', GOOGLE_APPLIANCE_RESULTS_PER_PAGE_DEFAULT);
  }

  // Convert comma-separated $page to an array, used by other functions.
  $pager_page_array = explode(',', $page);
  $pager_total_items[$element] = $total_results;
  $pager_total[$element] = ceil($pager_total_items[$element] / $limit);
  $pager_page_array[$element] = max(0, min((int) $pager_page_array[$element], (int) $pager_total[$element] - 1));
}