Conditional pagination li’s

Yes, but it is really more PHP than WordPress. You just need to reorder things and add some logic:

$next = get_next_posts_link( 'Previous', $the_query->max_num_pages );
$previous = get_previous_posts_link( 'Next' );
if(!empty($next)) {
  $links[] = '<li class="next">'.$next.'</li>';
}
if(!empty($previous)) {
  $links[] = '<li class="previous">'.$previous.'</li>';
}
if (!empty($links)) { ?>
  <nav class="post-nav clear clearfix">
    <ul><?php
      echo implode($links); ?>
    </ul>
  </nav><?php
}

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