Thanks! That’s what i was searching for, although it doesnt’ correctly show the number of pages if the what_to_show (show either days or XX posts on main page) is days:
Pages (999999): ? 1 [2] 3 4 5 ? … Last ?
Any ideas on how to fix that? Mb some request, that shows which days had the posts, and which hadn’t?
if (get_query_var(‘what_to_show’) == ‘posts’) {
preg_match(‘#FROM\s(.*)\sGROUP BY#siU’, $request, $matches);
//preg_match(‘#FROM\s(.*)\sORDER BY#siU’, $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var(“SELECT COUNT(DISTINCT ID) FROM $fromwhere”);
$max_page = ceil($numposts /$posts_per_page);
} else {
$max_page = 999999;
}