$nb_element_page) { $cur_page = ceil($start / $nb_element_page) + 1; $maximum = ceil($nb_element / $nb_element_page); $previous = $start - $nb_element_page; $next = $start + $nb_element_page; $last = ($maximum - 1) * $nb_element_page; $navbar['CURRENT_PAGE'] = $cur_page; // link to first page and previous page? if ($cur_page != 1) { $navbar['URL_FIRST'] = $url; $navbar['URL_PREV'] = $url.($previous > 0 ? $start_str.$previous : ''); } // link on next page and last page? if ($cur_page != $maximum) { $navbar['URL_NEXT'] = $url.$start_str.$next; $navbar['URL_LAST'] = $url.$start_str.$last; } // pages to display $navbar['pages'] = array(); $navbar['pages'][1] = $url; $navbar['pages'][$maximum] = $url.$start_str.$last; for ($i = max($cur_page - $pages_around , 2), $stop = min($cur_page + $pages_around + 1, $maximum); $i < $stop; $i++) { $navbar['pages'][$i] = $url.$start_str.(($i - 1) * $nb_element_page); } ksort($navbar['pages']); } return $navbar; } ?>