exec(); foreach ($res as $row) { $row['date'] = Util::prettyTime($row['dateline']); $row['icon'] = self::typeToIcon($row['logtypeid']); $row['color'] = self::typeToColor($row['logtypeid']); $lines[] = $row; } $paginate->render('_page', array( 'list' => $lines )); } private static function typeToIcon(string $type): string { switch ($type) { case 'info': return 'ok'; case 'warning': return 'exclamation-sign'; case 'failure': return 'remove'; default: return 'question-sign'; } } private static function typeToColor(string $type): string { switch ($type) { case 'warning': return 'orange'; case 'failure': return 'red'; case 'info': default: return ''; } } }