function getListOfNewestMessages($limit = 10)
 {
     global $I18N;
     $array = array_reverse(rex_cronjob_log::getYearMonthArray(), true);
     $messages = array();
     foreach ($array as $year => $months) {
         $months = array_reverse($months, true);
         foreach ($months as $month) {
             $lines = explode("\n", trim(rex_cronjob_log::getLogOfMonth($month, $year)));
             $end = min($limit - count($messages), count($lines));
             for ($i = 0; $i < $end; $i++) {
                 $messages[] = $lines[$i];
             }
             if (count($messages) >= $limit) {
                 break 2;
             }
         }
     }
     $caption = $I18N->msg('cronjob_log_caption_2');
     $summary = $I18N->msg('cronjob_log_summary_2');
     return rex_cronjob_log::_getList($messages, $caption, $summary);
 }
$year_sel->setStyle('width: 100px');
$month_sel = new rex_select();
$month_sel->setSize(1);
$month_sel->setName('log[month]');
$month_sel->setId('log_month');
$month_sel->setAttribute('class', 'rex-form-select');
$month_sel->setAttribute('onchange', 'this.form.submit();');
$month_sel->setStyle('width: 100px');
$log = rex_request('log', 'array', array());
if (!isset($log['year']) || !$log['year']) {
    $log['year'] = date('Y');
}
if (!isset($log['month']) || !$log['month']) {
    $log['month'] = date('m');
}
$array = rex_cronjob_log::getYearMonthArray();
if (empty($array)) {
    echo '
    <div class="rex-toolbar">
      <div class="rex-toolbar-content">
        <strong>' . $I18N->msg('cronjob_no_log_files') . '</strong>
        <div class="rex-clearer"></div>
      </div>
    </div>';
} else {
    $countYears = count($array);
    $i = 0;
    $yearSelected = false;
    foreach ($array as $year => $months) {
        $i++;
        $year_sel->addOption($year, $year);