= $PAGES){
$ERROR404 = 'page too high';
require_once('dis_404.php');
}
// check url
$canonical_url = $STRECKE['url_base'].$STRECKE['strecke_id'].'s'.($PAGE > 0 ? ($PAGE+1) : '').'.html';
if($_SERVER['REQUEST_URI'] != $canonical_url){
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$canonical_url);
die();
}
/*
** if no index: display first foto
*/
if(!$STRECKE['index']){
header('Location: '.$STRECKE['foto_ids'][0].'.html');
die();
}
header('X-Pictools-Log: '.$MANDANT[$_SERVER['SERVER_NAME']][0].';strecke;'.$STRECKE['strecke_id']);
// generate all thumbnails
$FOTOS = array();
for($i=$PAGE*$PicsPerPage; $i<($PAGE+1)*$PicsPerPage; $i++){
if(isset($STRECKE['foto_ids'][$i])){
$FOTOS[] = '';
// $FOTOS[] = '';
}
}
// insert werbung
if($WERBUNG['index'] != ''){
array_splice($FOTOS, mt_rand(0, count($FOTOS)), 0, '
| '.$WERBUNG['index'].' | |
');
}
// add empty elements
while(count($FOTOS) < 16){
$FOTOS[] = '';
}
$out = '';
$out .= '';
for($j=0; $j<4; $j++){
$out .= '';
for($i=0; $i<4; $i++){
$out .= ''.$FOTOS[$j*4+$i].' | ';
if($i<3){
$out .= ' | ';
}
}
$out .= '
';
if($j<3){
$out .= ' |
';
}
}
$out .= display_timeline(7, $PAGE/ceil($STRECKE['fotos']/$PicsPerPage-1));
if($STRECKE['timeline']){
$REPLACE['%%TITEL%%'] .= ' — '.$STRECKE['timeline_frames'][$PAGE*$PicsPerPage].' - '.$STRECKE['timeline_frames'][$PAGE*$PicsPerPage+$PicsPerPage-1];
}
$out .= ' |
';
if($PAGES > 1){
if($STRECKE['timeline']){
}else{
$out .= 'Seiten: ';
if($PAGES <= 15){
for($i=1; $i<=$PAGES; $i++){
if($i-1 == $PAGE){
$out .= ''.$i.' ';
}else{
$out .= ''.$i.' ';
}
}
}else{
$pg = array_fill(1, $PAGES, false);
$pg[1] = 'k';
$pg[$PAGES] = 'k';
for($i=10; $i<$PAGES; $i+=10){
$pg[$i] = 'k';
}
for($j=-3; $j<=3; $j++){
if($PAGE+1+$j >= 1 && $PAGE+1+$j <= $PAGES){
$pg[$PAGE+1+$j] = true;
}
}
foreach($pg AS $k => $v){
if($v && $k > 1 && $pg[$k-1] == false){
if($k <= 2 || $pg[$k-2] == true){
$out .= '.';
}else{
$out .= '..';
}
}else if($v){
$out .= ' ';
}
if($k-1 == $PAGE){
$out .= ''.$k.'';
}else if($v){
if($v === 'k'){
$out .= '';
}
$out .= ''.$k.'';
if($v === 'k'){
$out .= '';
}
}
}
}
$out .= ' |
';
}
$out .= ' |
';
}
$out .= 'Tags: %%TAGS%% | ';
$REPLACE['%%LIST%%'] = $out;
$REPLACE['%%PIC-NUM%%'] = $PAGE+1;
$REPLACE['%%PIC-COUNT%%'] = $PAGES;
$REPLACE['%%LINK-PREV%%'] = $STRECKE['strecke_id'].'s'.($PAGE == 0 ? ($PAGES) : $PAGE).'.html';
$REPLACE['%%LINK-NEXT%%'] = $STRECKE['strecke_id'].'s'.($PAGE+1 == $PAGES ? '1' : ($PAGE+2)).'.html';
$REPLACE['%%TAGS%%'] = implode(', ', $tags_out);
output_page();
// debug
//echo ''.htmlspecialchars(var_export(array($PAGE,$WERBUNG,$STRECKE,$_SERVER['SERVER_NAME']),true));
?>