public function index() { $channel = '#' . $this->request->channel; $year = $this->request->year ?: date('Y'); if (!in_array($channel, LogMessages::channels())) { throw new Exception('Unknown channel.'); } $breadcrumbs[] = array('title' => 'Channel Logs', 'url' => array('library' => 'li3_bot', 'controller' => 'logs', 'action' => 'channels')); $breadcrumbs[] = array('title' => $channel, 'url' => null); $breadcrumbs[] = array('title' => $year, 'url' => array('library' => 'li3_bot', 'controller' => 'logs', 'action' => 'index', 'channel' => ltrim($channel, '#')) + compact('year')); $calendar = LogMessages::calendar($channel, $year); $previous = $year - 1; $next = $year + 1; if (!LogMessages::hasYear($channel, $previous)) { $previous = null; } if (!LogMessages::hasYear($channel, $next)) { $next = null; } return compact('channels', 'channel', 'calendar', 'year', 'breadcrumbs', 'next', 'previous'); }