$limit ) { $nEvents = $limit; Logger::Debug("Number of events: $nEvents"); } $pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE); if ( !empty($page) ) { if ( $page < 0 ) $page = 1; else if ( $page > $pages ) $page = $pages; } if ( !empty($page) ) { $limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE); if ( empty( $limit ) ) { $limitAmount = ZM_WEB_EVENTS_PER_PAGE; } else { $limitLeft = $limit - $limitStart; $limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft; } $eventsSql .= " limit $limitStart, $limitAmount"; } elseif ( !empty( $limit ) ) { $eventsSql .= ' limit 0, '.$limit; } $maxShortcuts = 5; $pagination = getPagination( $pages, $page, $maxShortcuts, $filterQuery.$sortQuery.$limitQuery ); $focusWindow = true; if ($_POST) { header("Location: " . $_SERVER['REQUEST_URI'].htmlspecialchars_decode($filterQuery).htmlspecialchars_decode($sortQuery).$limitQuery.'&page='.$page); exit(); } xhtmlHeaders(__FILE__, translate('Events') ); ?>