You are here

function mongodb_watchdog_pager_init in MongoDB 7

Same name and namespace in other branches
  1. 6 mongodb_watchdog/mongodb_watchdog.admin.inc \mongodb_watchdog_pager_init()

Initialize the pager variables for use in a mongodb_watchdog event list.

1 call to mongodb_watchdog_pager_init()
mongodb_watchdog_event in mongodb_watchdog/mongodb_watchdog.admin.inc
Display watchdogs entry details in MongoDB.

File

mongodb_watchdog/mongodb_watchdog.admin.inc, line 252
Settings for mongodb. Moved back to module file.

Code

function mongodb_watchdog_pager_init($element, $limit, $total) {
  global $pager_page_array, $pager_total, $pager_total_items;

  // Initialize pager, see pager.inc.
  $page = isset($_GET['page']) ? $_GET['page'] : '';
  $pager_page_array = explode(',', $page);
  if (!isset($pager_page_array[$element])) {
    $pager_page_array[$element] = 0;
  }
  $pager_total_items[$element] = $total;
  $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));
  return isset($pager_page_array[$element]) ? $pager_page_array[$element] : 0;
}