= $totalTwts ) {
//echo "Only " . $totalTwts . " so no need for pagnation. (max: ". $twts_per_page . ")
";
$paginateTwts = false;
} else {
//echo "Over " . $twts_per_page . " so pagnation is needed.
";
$paginateTwts = true;
}
$page = 1;
if (!empty($_GET['page'])) {
$page = intval($_GET['page']);
}
// If we should paginate our twts list
if (!empty($paginateTwts)) {
$startingTwt = (($page - 1) * TWTS_PER_PAGE);
$twts = array_slice($twts, $startingTwt, TWTS_PER_PAGE);
}
# Approach 2: Ignore invalid page numbers, and adjust the number between 1 and the last page
$currentPage = max(1, min($_GET["page"], $totalPages));
# And then in the HTML template only show the next page link if we are NOT on the last one
if ($currentPage < $totalPages) {
$output .= '> Next Page';
}
$totalTwts = count($twts);
//echo "pagnation twts: " . $totalTwts;
$totalPages = ceil($totalTwts / $twts_per_page);
//echo "
total pages: " . $totalPages;
$page_url = $_SERVER['REQUEST_URI'];
//echo $page_url."