You can use get_previous_posts_link
and get_next_posts_link
to determine if they exists like this:
$prev_link = get_previous_posts_link(__('« Older Entries'));
$next_link = get_next_posts_link(__('Newer Entries »'));
// as suggested in comments
if ($prev_link || $next_link) {
echo '<ul class="navigation">';
if ($prev_link){
echo '<li>'.$prev_link .'</li>';
}
if ($next_link){
echo '<li>'.$next_link .'</li>';
}
echo '</ul>';
}
Hope This Helps