The code below is the function for pagination in my wordpress blog. Presently it outputs 7 pages and then the .. last page number.
How can I reduce this number so it shows only 5 pages and then ... last page number?
function emm_paginate_loop($start, $max, $page = 0) {
$output = "";
for ($i = $start; $i <= $max; $i++) {
$output .= ($page === intval($i))
? "<span class='emm-page emm-current'>$i</span>"
: "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";
}
return $output;
}