// Define the number of results per page.
$max_results = 10;
// Figure out the total number of results in DB.
$total_results = $vbulletin->db->query_first("SELECT COUNT(*) AS threads FROM " . TABLE_PREFIX . "thread");
echo 'Total Rows To Display: '. $total_results['threads']. '<br /><br />';
// Figure out the total number of pages.
$total_pages = ceil($total_results['threads']/$max_results);
echo "<div align=\"right\">Page $page of $total_pages: ";