asgarosforum = $object;
}
public function renderTopicOverviewPagination($topic_id, $topic_counter) {
$num_pages = ceil($topic_counter / $this->asgarosforum->options['posts_per_page']);
// Only show pagination when there is more than one page.
if ($num_pages > 1) {
echo ' ·
';
if ($num_pages <= 5) {
for ($i = 1; $i <= $num_pages; $i++) {
$this->render_page_link('topic', $topic_id, $i);
}
} else {
for ($i = 1; $i <= 3; $i++) {
$this->render_page_link('topic', $topic_id, $i);
}
$link = $this->asgarosforum->get_link('topic', $topic_id, array('part' => $num_pages));
echo '
'.esc_html(_x('Last', 'Last topic', 'asgaros-forum')).' ';
}
echo '
';
}
}
public function render_page_link($location, $id, $page) {
$link = $this->asgarosforum->get_link($location, $id, array('part' => $page));
echo '';
// First page
if ($current_page >= 2) {
$link = remove_query_arg('part', $select_url);
$out .= '
';
}
// Previous page
if ($current_page >= 1) {
$link = add_query_arg('part', ($current_page + 1) - 1, $select_url);
$out .= '
'.__('Previous', 'asgaros-forum').'';
}
$out .= '
'.sprintf(__('Page %s of %s', 'asgaros-forum'), number_format_i18n($current_page + 1), number_format_i18n($num_pages)).'';
// Next page
if (($current_page + 1) < $num_pages) {
$link = add_query_arg('part', ($current_page + 1) + 1, $select_url);
$out .= '
'.__('Next', 'asgaros-forum').' ';
}
// Last page
if (($current_page + 1) < ($num_pages - 1)) {
$link = add_query_arg('part', $num_pages, $select_url);
$out .= '
';
}
$out .= '
';
return $out;
} else {
return false;
}
}
}