If you look at new_posts_link , you will see $ max_page and $ paged vars.
If $ pages above is up to 1, there is a link to the previous page.
This is less than $ max_page, there is a link to the next page.
So, you can perform the following functions:
function has_next_page() {
global $paged, $max_page;
return $paged < $max_page;
}
function has_previous_page() {
global $paged;
return $paged > 1;
}
function has_pagination() {
return has_next_page() or has_previous_page();
}
source
share