$limit ) { $nEvents = $limit; } $pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE); if ( $pages > 1 ) { if ( !empty($page) ) { if ( $page < 0 ) $page = 1; 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; } $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, $page, $maxShortcuts, $filterQuery.$sortQuery.'&limit='.$limit ); $focusWindow = true; xhtmlHeaders(__FILE__, $SLANG['Events'] ); ?>