I've read the whole thread and there seems to be a bit of mess about how to accomplish previous and next tabs.
As of today (CPG 1.4.20), the one and only edit needed is to copy and paste the following function just before the end of themes/your_theme/theme.php:
function theme_create_tabs($items, $curr_page, $total_pages, $template)
{
global $CONFIG, $lang_create_tabs;
$maxTab = $CONFIG['max_tabs'];
$tabs = sprintf($template['left_text'], $items, $total_pages);
if (($total_pages == 1)) return $tabs;
$tabs .= $template['tab_header'];
if ($curr_page == 1) {
$tabs .= sprintf($template['active_tab'], 1);
} else {
if ($curr_page > 1) $tabs .= strtr( sprintf($template['inactive_prev_tab'], $curr_page-1) , array('{PREV}' => $lang_create_tabs['previous']) );
$tabs .= sprintf($template['inactive_tab'], 1, 1);
}
if ($total_pages > $maxTab){
$start = max(2, $curr_page - floor(($maxTab -2)/2));
$start = min($start, $total_pages - $maxTab +2);
$end = $start + $maxTab -3;
} else {
$start = 2;
$end = $total_pages-1;
}
for ($page = $start ; $page <= $end; $page++) {
if ($page == $curr_page) {
$tabs .= sprintf($template['active_tab'], $page);
} else {
$tabs .= sprintf($template['inactive_tab'], $page, $page);
}
}
if ($total_pages > 1) {
if ($curr_page == $total_pages) {
$tabs .= sprintf($template['active_tab'], $total_pages);
} else {
$tabs .= sprintf($template['inactive_tab'], $total_pages, $total_pages);
$tabs .= strtr( sprintf($template['inactive_next_tab'], $curr_page+1) , array('{NEXT}' => $lang_create_tabs['next']) );
}
}
return $tabs.$template['tab_trailer'];
}
I'm using this mod in my gallery without any trouble, so far.