I've looked at many of the previous category loop related topics on the forum but I've had no luck sorting this out.
Essentially I'm running this query within category.php but I cannot get the pagination to work. If I have 6 posts, it correctly breaks down the posts into 3 per page and pagenavi shows 2 pages, however clicking on the page 2 link returns a page not found error. If I were to have three pages, pages 1 and 2 would work, but page 3 wouldn't. It's the last page in all cases that doesn't work. Removing the "posts_per_page" option and setting the number of posts per page via Settings > Reading does work, but I need to specify it from the page itself. Hopefully someone can help.
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string.'&posts_per_page=3&paged='.$paged.'&cat='.$current_cat); if (have_posts()) : while (have_posts()) : the_post(); ?>
CODE HERE
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php endif; wp_reset_query(); ?>