$_REQUEST['limit'] ) { $nEvents = $_REQUEST['limit']; } $pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE); if ( $pages > 1 ) { if ( !empty($_REQUEST['page']) ) { if ( $_REQUEST['page'] < 0 ) $_REQUEST['page'] = 1; if ( $_REQUEST['page'] > $pages ) $_REQUEST['page'] = $pages; } } if ( !empty($_REQUEST['page']) ) { $limit_start = (($_REQUEST['page']-1)*ZM_WEB_EVENTS_PER_PAGE); if ( empty( $_REQUEST['limit'] ) ) { $limit_amount = ZM_WEB_EVENTS_PER_PAGE; } else { $limit_left = $_REQUEST['limit'] - $limit_start; $limit_amount = ($limit_left>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limit_left; } $eventsSql .= " limit $limit_start, $limit_amount"; } elseif ( !empty( $_REQUEST['limit'] ) ) { $eventsSql .= " limit 0, ".$_REQUEST['limit']; } $maxWidth = 0; $maxHeight = 0; $archived = false; $unarchived = false; $events = array(); foreach ( dbFetchAll( $eventsSql ) as $event ) { $events[] = $event; $scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); $eventWidth = reScale( $event['Width'], $scale ); $eventHeight = reScale( $event['Height'], $scale ); if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth; if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight; if ( $event['Archived'] ) $archived = true; else $unarchived = true; } $maxShortcuts = 5; $pagination = getPagination( $pages, $_REQUEST['page'], $maxShortcuts, $filterQuery.$sortQuery.'&limit='.$_REQUEST['limit'] ); $focusWindow = true; xhtmlHeaders(__FILE__, $SLANG['Events'] ); ?>