max_num_pages says 4, yet I am only able to navigate to the third page

You’re assigning three different values to your variable:

if ( get_query_var('paged') )
{
    $paged = get_query_var('paged'); 
}
else if ( get_query_var('page') )
{
    $paged = get_query_var('page');
}
else
{
    $paged = 1;
}

Short explanation:

  1. On single.php, singular.php and other single view templates: (int) $page Is the page of the post, as specified by the query var page: get_query_var( 'page' );
  2. On all sorts of archive.php and similar archive/post type list view templates: (int) $paged Is the global variable contains the page number of a listing of posts (as in archives).

Core uses a lot of (slightly confusing) globals (so don’t blame yourself).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)