$title";
}
function generate_pagination_image($id, $alt)
{
global $webimroot;
return "";
}
function prepare_pagination($items_count, $default_items_per_page = 15)
{
global $page;
if ($items_count) {
$items_per_page = verifyparam("items", "/^\d{1,3}$/", $default_items_per_page);
if ($items_per_page < 2)
$items_per_page = 2;
$total_pages = div($items_count + $items_per_page - 1, $items_per_page);
$curr_page = verifyparam("page", "/^\d{1,6}$/", 1);
if ($curr_page < 1)
$curr_page = 1;
if ($curr_page > $total_pages)
$curr_page = $total_pages;
$start_index = ($curr_page - 1) * $items_per_page;
$end_index = min($start_index + $items_per_page, $items_count);
$page['pagination'] =
array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages,
"count" => $items_count, "start" => $start_index, "end" => $end_index,
"limit" => "LIMIT $start_index," . ($end_index - $start_index));
} else {
$page['pagination'] = true;
}
}
function setup_pagination($items, $default_items_per_page = 15)
{
global $page;
prepare_pagination($items ? count($items) : 0, $default_items_per_page);
if ($items && count($items) > 0) {
$p = $page['pagination'];
$page['pagination.items'] = array_slice($items, $p['start'], $p['end'] - $p['start']);
} else {
$page['pagination.items'] = false;
}
}
function select_with_pagintation($fields, $table, $conditions, $order, $countfields, $link)
{
global $page;
$count = db_rows_count($table, $conditions, $countfields, $link);
prepare_pagination($count);
if ($count) {
$p = $page['pagination'];
$limit = $p['limit'];
$page['pagination.items'] = select_multi_assoc(db_build_select($fields, $table, $conditions, $order) . " " . $limit, $link);
} else {
$page['pagination.items'] = false;
}
}
function setup_empty_pagination()
{
global $page;
$page['pagination.items'] = false;
$page['pagination'] = false;
}
function generate_pagination($pagination, $bottom = true)
{
global $pagination_spacing, $links_on_page;
$result = getlocal2("tag.pagination.info",
array($pagination['page'], $pagination['total'], $pagination['start'] + 1, $pagination['end'], $pagination['count'])) . "
";
if ($pagination['total'] > 1) {
if (!$bottom) {
$result = "";
} else {
$result .= "
";
}
$result .= "