Warning: unlink(./data/secure/tokens/6946349cb14e9cbcd19956fb90d8fcdc0f5fa9a35322c9884766a72189e17481860b3ebf3ac26edc333af85daa45f66d623ef7d1b2a8b51f1037adab4e09dfc4.token): No such file or directory in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 865
Warning: filemtime(): stat failed for ./data/secure/tokens/7f40c22d6a0e1d2072297a087479168bd8783813cddb8cb7976aa015a6ce8e4b485e6172cd1d23fabfbda24ee3ae09e4ee6c42627099b676e69b34d73fe18497.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831
Warning: unlink(./data/secure/tokens/d95d24df6b0d90cf7f4db36803b25261e54471c049643a3cd62064b5d69f11de70ea67fd9d66f6f86b1a26503c7548487ba948c4d24777f9db0da7bb67eca267.token): No such file or directory in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 865
Warning: filemtime(): stat failed for ./data/secure/tokens/ecab6a9627670cf51c7d08ce4a962287519034baeebb24600d4d09d7ec62506b0e60fea9515206a306b019db1d217d2d9369198ab98a05d3096b6247ef9ebb93.token in /home/sigesthaxo/snippetvamp/assets/php/class/Helium_secure_class.php on line 831
/**
* Generate an array of pagination link where the key is a page number
* and the value is a type of link (current page, normal link, first/last page link)
* @param integer $currentPage the current displayed page
* @param integer $totalPages the total number of pages (can be replaced by the two following params)
* @param integer $itemPerPage the number of item displayed on each page
* @param integer $totalItems the total number of existing items
* @param integer $nbPagesAround the maximum number of links (excluding first/last) that should be displayed before or after the current page
* @return array the pagination array (key = page to link to, value = type of link)
*/
function generatePagination(
$currentPage,
$totalPages = 0,
$itemPerPage = 0,
$totalItems = 0,
$nbPagesAround = 2
) {
$pagination = array();
if($totalPages == 0) {
if($itemPerPage == 0 || $totalItems == 0) {
return false;
} else {
$totalPages = (int)ceil($totalItems / $itemPerPage);
}
}
if($currentPage > $nbPagesAround + 2) {
$pagination[1] = self::PAGINATION_FIRST;
} elseif($currentPage > $nbPagesAround + 1) {
$pagination[1] = self::PAGINATION_LINK;
}
for($i = ($currentPage - $nbPagesAround); $i < $currentPage; $i++) {
if($i > 1 || ($i == 1 && $currentPage <= $nbPagesAround + 1)) {
$pagination[$i] = self::PAGINATION_LINK;
}
}
$pagination[$currentPage] = self::PAGINATION_CURRENT;
for($i = ($currentPage + 1); $i < ($currentPage + $nbPagesAround + 1); $i++) {
if($i < $totalPages
|| ($i == $totalPages && $currentPage >= $totalPages - $nbPagesAround)
) {
$pagination[$i] = self::PAGINATION_LINK;
}
}
if($currentPage < ($totalPages - $nbPagesAround - 1)) {
$pagination[$totalPages] = self::PAGINATION_LAST;
} elseif($currentPage < ($totalPages - $nbPagesAround)) {
$pagination[$totalPages] = self::PAGINATION_LINK;
}
// ksort($pagination);
return $pagination;
}