I found a better way to do this.
In the html1.php page, you can limit how many pages of results are generated.
For example, I wanted to always limit the number of pages to generate on my index page for only 150 items at the most.
So in do_pages function, I added the following code after the global declaration:
Code:
if ($thepage == 'published') {
$total = ($total > 150) ? 150 : $total;
}
That ensured that I would only generate pages for 150 items at the most.
You can change that number by replacing the '150' in the code with any number.
Hope this helps.