<?php
defined('IN_DESTOON') or exit('Access Denied');
$_page = $page <= 1 ? $total : ($page - 1);
$demo_url = str_replace(array('%7B', '%7D'), array('{', '}'), $demo_url);
$url = $_page == 1 ? $home_url : str_replace('{destoon_page}', $_page, $demo_url);
$pages .= '<input type="hidden" id="previous" value="'.$url.'"/><a class="page-link" href="'.$url.'"> '.$L['prev_page'].' </a> ';
if($total >= 1) {
$_page = 1;
$url = $home_url;
$pages .= $page == $_page ? '<a class="page-link"> '.$_page.' </a> ' : ' <a class="page-link" href="'.$url.'"> '.$_page.' </a> ';
}
if($total >= 2) {
$_page = 2;
$url = str_replace('{destoon_page}', $_page, $demo_url);
$pages .= $page == $_page ? '<a class="page-link"> '.$_page.' </a> ' : ' <a class="page-link" href="'.$url.'"> '.$_page.' </a> ';
}
if($total >= 3) {
$pages .= '';
if($total > 4) {
if($page <= 2) {
$min = 3; $max = 3 + $step*2;
} else if($page >= $total - 1) {
$min = $total - 2 - $step*2; $max = $total - 2;
} else {
$min = $page - $step; $max = $page + $step;
}
if($min < 3) $min = 3;
if($max > $total - 2) $max = $total - 2;
if($page == 3) while($max < $page + $step*2 && $max < $total - 2) { $max++; }
if($page == 4) while($max < $page + $step*2 - 1 && $max < $total - 2) { $max++; }
if($page == $total - 3) while($min > $page - $step*2 + 1 && $min - 1 > 2) { $min--;}
if($page == $total - 2) while($min > $page - $step*2 && $min - 1 > 2) { $min--; }
for($_page = $min; $_page <= $max; $_page++) {
$url = $_page == 1 ? $home_url : str_replace('{destoon_page}', $_page, $demo_url);
$pages .= $page == $_page ? '<a class="page-link"> '.$_page.' </a> ' : ' <a class="page-link" href="'.$url.'"> '.$_page.' </a> ';
}
$pages .= '';
}
}
$_page = $page >= $total ? 1 : $page + 1;
$url = $_page == 1 ? $home_url : str_replace('{destoon_page}', $_page, $demo_url);
$pages .= '<a class="page-link" href="'.$url.'"> '.$L['next_page'].'</a> ';
?>
/api/pages.default.php