| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
||
| 12 | public function index(int $titleID, int $page = 1) : void { |
||
| 13 | $this->header_data['title'] = "Title History"; |
||
| 14 | $this->header_data['page'] = "history"; |
||
| 15 | |||
| 16 | //CHECK: Should we only allow people to see history for series they are tracking? |
||
| 17 | $historyData = $this->History->getTitleHistory((int) $titleID, $page); |
||
| 18 | |||
| 19 | if(!empty($historyData['title'])) { |
||
| 20 | $this->body_data['title'] = $historyData['title']; |
||
| 21 | $this->body_data['historyData'] = $historyData['rows']; |
||
| 22 | $this->body_data['currentPage'] = $page; |
||
| 23 | $this->body_data['totalPages'] = $historyData['totalPages']; |
||
| 24 | $this->body_data['titleID'] = (int) $titleID; |
||
| 25 | |||
| 26 | if($page > $this->body_data['totalPages'] && $page > 1) redirect("/history/{$titleID}/1"); |
||
| 27 | |||
| 28 | $this->_render_page("TitleHistory"); |
||
| 29 | |||
| 30 | } else { |
||
| 31 | show_404(); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | } |
||
| 35 |