Pagination in category

First, don’t use query_posts.

  1. There are no pagination functions that I can spot in your code. That
    is a big problem if you want pagination to work.
  2. Nor do you have a pagination parameter in your query_posts (which
    you should not be using) arguments.
  3. The simple pagination functions like next_posts_link may not
    work in your case anyway, without complicated filtering, as those rely on the main query and you are paginating something other than that query.

Plus, I don’t see how you are even attempting to break these into fives (%3 is not going to do that ??).

I don’t really see how that code is even an attempt to do what you describe, but here is an outline to get you started in the right direction. I have not made any effort to duplicate the markup you need. You should be able to work that into the Loop yourself.

// set pagination
$page = (!empty($_GET['catp'])) ? $_GET['catp'] : 1; 
// pull catagories
$cats = get_categories();
// break them into blocks of 5  
$cats = array_chunk($cats,5); 
// grab the five category IDs we need for the query 
$ids = wp_list_pluck($cats[$page - 1],'term_id');
// query for the posts in those categories
$args = array(
  'category__in' => $ids,
  'ignore_sticky_posts' => true
);
$incats = new WP_Query($args);
// Minimal Loop; proof of concept only
if ($incats->have_posts()) {
  while ($incats->have_posts()) {
    $incats->the_post();
    the_title();
    echo '<br/>';
  }
}
// paginate
$page_args = array(
    'base'         => '%_%',
    'format'       => '?catp=%#%',
    'total'        => count($cats),
    'current'      => $page,
    'show_all'     => False,
    'end_size'     => 1,
    'mid_size'     => 2,
    'prev_next'    => True,
    'prev_text'    => __('« Previous'),
    'next_text'    => __('Next »'),
    'type'         => 'plain',
);
echo paginate_links($page_args);