function aware_paginate($current_page, $limit = 10) { $str = ""; if ($current_page > 0) { $str .= "<a href=?page=" . ($current_page - 1) . ">Previous page</a> | "; } else { $str .= "Previous page | "; } $start = $current_page * $limit; $events = aware_event_get_list(STORAGE_MODULE, $start + $limit, $limit); if (count($events)) { $str .= "<a href=?page=" . ($current_page + 1) . ">Next page</a>"; } else { $str .= 'Next page'; } return $str; }
$page = isset($_GET['page']) ? $_GET['page'] : 0; echo aware_paginate($page, $limit); $start = $page * $limit; ?> <table> <thead> <tr> <td width='50'></td> <td>error message</td> <td>filename</td> <td>error</td> <td>host</td> </tr> </thead> <?php $events = aware_event_get_list(STORAGE_MODULE, $start, $limit); foreach ($events as $uuid) { echo aware_event_row($uuid); } ?> </table> <?php break; ?> <?php case 'view': ?> <a href="?">To listing</a>