Post pagination solution not working after first load next page is wrong

Hi,
I am using this solution http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/
which is based on this code, which I am linking to as well as it contains much more of an explanation http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin

My site is here http://babasouk.ca/blog/

If you look at the pagination at the bottom of the page you will see it correctly says Page 1 of 13. This appears to be correct given the number of blog posts is 65, set in WordPress at 5 per page.

When you click page 2 the pagination now displays page 1 of 2, with 2 links. It does display blog posts properly.
If you navigate back to Page 1 it displays the pagination properly. BUT if you click any number over 2, or the last button you get a page of text from various Product custom post types. These should not be showing at all. These pages do not display any pagination at the bottom.

I did think this was working before I updated WP and plugins but it could just be that when I built it there was not more than 2 pages of blog posts and I did not see the error. It does not work with all plugins deactivated.

when I echo ‘max_num_pages’ I get 13 on the first blog page, 2 on the second page then nothing on the others of course

My function code

//add blog page pagination
<?php  
function babasouk_pagination($pages = '', $range = 3)
{
     $showitems = ($range * 2)+1;  
 
     global $paged;
     if(empty($paged)) $paged = 1;
 
     if($pages == '')
     {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
		 echo $wp_query->max_num_pages;
         if(!$pages)
         {
             $pages = 1;
         }
     }   
 
     if(1 != $pages)
     {
         echo "<div class=\\"pagination-storefront\\"><span>Page ".$paged." of ".$pages."</span>";
         if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
         if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";
 
         for ($i=1; $i <= $pages; $i++)
         {
             if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
             {
                 echo ($paged == $i)? "<span class=\\"current\\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\\"inactive\\">".$i."</a>";
             }
         }
 
         if ($paged < $pages && $showitems < $pages) echo "<a href=\\"".get_pagenum_link($paged + 1)."\\">Next &rsaquo;</a>";
         if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
         echo "</div>\
";
     }
}  ?> 

My Index page code

<?php get_header(); ?>
<!--removed a big not relevant script here-->
  <div class="leftcontent">
  <div id="no-grid">
 
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
 
      <div id="no-grid-post">          
 
          <h3 class="cufon" style="margin-bottom:10px;"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
<small><?php _e( 'Written by', 'storefront' ); ?> <?php echo get_the_author_link(); ?> <?php _e( 'on', 'storefront' ); ?> <?php echo get_the_date(); ?> - <?php _e( 'Posted in', 'storefront' ); ?> <?php the_category(', '); ?></small>
<div class="clear"></div>
 
          <?php the_content("Continue reading " . the_title('', '', false)); ?>

<p class ="baba-comment">
  <img src="http://babasouk.ca/wp-content/themes/storefront-gridport-1.0.6/images/heart-peach-baba-souk.png" width="31px" height="25px" class="comment-graphic" /><a href="<?php echo get_permalink(); ?>">
  <?php comments_number( 'no comments. ', 'one comment. ', '% comments. ' ); ?>Leave yours!</a>
</p>

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style">
<a class="addthis_button_facebook" style="cursor:pointer"><img src="http://babasouk.ca/wp-content/uploads/2012/11/facebook-show-us-love.png" width="81" height="33" border="0" alt="Share to Facebook" /></a></a>
<a class="addthis_button_pinterest" style="cursor:pointer"><img src="http://babasouk.ca/wp-content/uploads/2012/11/Pin-it-with-love.png"*width="89" height="34" border="0" alt="Pin to Pinterest" /></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4f68a5233b334932"></script>
<!-- AddThis Button END -->

<?php if (function_exists('nrelate_related')) nrelate_related(); ?>
 
      <div class="clear"></div>
      </div>             
<?php  
endwhile; ?>
  <?php else : ?>

  
  <div><p><?php _e( 'No posts found. Try a different search?', 'storefront' ); ?></p></div>
  

  <?php endif; ?>
<?php if (function_exists("babasouk_pagination")) {
    babasouk_pagination($additional_loop->max_num_pages);
} ?>

	
	</div><!-- grid-content -->
</div>
	<?php get_sidebar(); ?>


<?php get_footer(); ?>