Well none of them didn’t work for me. So I edited template like this…
I found the code piece(it varies from template to template):
if ( !$max_page ) {
if ( isset($max_num_pages) ) $max_page = $max_num_pages;
else {
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
$max_page = $max_num_pages = ceil($numposts / $posts_per_page);
}
}..........
and replaced it by
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div>
found in default wordpress template. Now pagination is working normally and there is no any more errors.