Is this a correct way to get the total ui_count? What if each page does not contain the same number of results, in particular the final page may not have a full result set. 

I realized belatedly that the pseudo code <code>var ui_count = results_on_page * number_of_pages</code> might have been incorrect. Thoughts?