| @@ 208-225 (lines=18) @@ | ||
| 205 | * @return int |
|
| 206 | * The number of the page to display, starting at 0. |
|
| 207 | */ |
|
| 208 | public function setupPager(EventTemplate $template, Request $request) { |
|
| 209 | $count = $this->watchdog->eventCount($template); |
|
| 210 | $height = $this->itemsPerPage; |
|
| 211 | pager_default_initialize($count, $height); |
|
| 212 | ||
| 213 | $page = intval($request->query->get('page')); |
|
| 214 | if ($page < 0) { |
|
| 215 | $page = 0; |
|
| 216 | } |
|
| 217 | else { |
|
| 218 | $page_max = intval(min(ceil($count / $height), PHP_INT_MAX) - 1); |
|
| 219 | if ($page > $page_max) { |
|
| 220 | $page = $page_max; |
|
| 221 | } |
|
| 222 | } |
|
| 223 | ||
| 224 | return $page; |
|
| 225 | } |
|
| 226 | ||
| 227 | } |
|
| 228 | ||
| @@ 317-334 (lines=18) @@ | ||
| 314 | * @return int |
|
| 315 | * The number of the page to display, starting at 0. |
|
| 316 | */ |
|
| 317 | public function setupPager(Request $request) { |
|
| 318 | $count = $this->watchdog->templatesCount(); |
|
| 319 | $height = $this->itemsPerPage; |
|
| 320 | pager_default_initialize($count, $height); |
|
| 321 | ||
| 322 | $page = intval($request->query->get('page')); |
|
| 323 | if ($page < 0) { |
|
| 324 | $page = 0; |
|
| 325 | } |
|
| 326 | else { |
|
| 327 | $page_max = intval(min(ceil($count / $height), PHP_INT_MAX) - 1); |
|
| 328 | if ($page > $page_max) { |
|
| 329 | $page = $page_max; |
|
| 330 | } |
|
| 331 | } |
|
| 332 | ||
| 333 | return $page; |
|
| 334 | } |
|
| 335 | ||
| 336 | } |
|
| 337 | ||