function print_table($data)
{
    $table = new html_table();
    $table->head = array(get_string('lastcrawledtime', 'local_linkchecker_robot'), get_string('linktext', 'local_linkchecker_robot'), get_string('idattr', 'local_linkchecker_robot'), get_string('response', 'local_linkchecker_robot'), get_string('size', 'local_linkchecker_robot'), get_string('url', 'local_linkchecker_robot'), get_string('mimetype', 'local_linkchecker_robot'));
    $table->data = array();
    foreach ($data as $row) {
        $text = trim($row->title);
        if (!$text || $text == "") {
            $text = get_string('unknown', 'local_linkchecker_robot');
        }
        $code = local_linkchecker_robot_http_code($row);
        $size = $row->filesize * 1;
        $data = array(userdate($row->lastcrawled, '%h %e,&nbsp;%H:%M:%S'), $row->text, str_replace(' #', '<br>#', $row->idattr), $code, display_size($size), local_linkchecker_robot_link($row->target, $text, $row->redirect), $row->mimetype);
        $table->data[] = $data;
    }
    echo html_writer::table($table);
}
     $opts = array();
     $data = $DB->get_records_sql("SELECT b.id,\n                                          b.url target,\n                                          b.lastcrawled,\n                                          b.filesize,\n                                          b.httpcode,\n                                          b.httpmsg,\n                                          b.title,\n                                          b.redirect,\n                                          b.mimetype,\n                                          b.courseid,\n                                          c.shortname\n                                          {$sql}\n                                 ORDER BY b.lastcrawled DESC", $opts, $start, $perpage);
     $count = $DB->get_field_sql("SELECT count(*) AS count" . $sql, $opts);
     $mdlw = strlen($CFG->wwwroot);
     $table = new html_table();
     $table->head = array(get_string('lastcrawledtime', 'local_linkchecker_robot'), get_string('response', 'local_linkchecker_robot'), get_string('size', 'local_linkchecker_robot'), get_string('url', 'local_linkchecker_robot'), get_string('mimetype', 'local_linkchecker_robot'));
     if (!$courseid) {
         array_push($table->head, get_string('incourse', 'local_linkchecker_robot'));
     }
     $table->data = array();
     foreach ($data as $row) {
         $text = trim($row->title);
         if (!$text || $text == "") {
             $text = get_string('unknown', 'local_linkchecker_robot');
         }
         $code = local_linkchecker_robot_http_code($row);
         $size = $row->filesize * 1;
         $data = array(userdate($row->lastcrawled, '%h %e,&nbsp;%H:%M:%S'), $code, display_size($size), local_linkchecker_robot_link($row->target, $text, $row->redirect), $row->mimetype);
         if (!$courseid) {
             array_push($data, html_writer::link('/course/view.php?id=' . $row->courseid, $row->shortname));
         }
         $table->data[] = $data;
     }
 } else {
     if ($report == 'oversize') {
         $sql = " FROM {linkchecker_url} b\n       LEFT JOIN {linkchecker_edge} l ON l.b = b.id\n       LEFT JOIN {linkchecker_url}  a ON l.a = a.id\n       LEFT JOIN {course} c ON c.id = a.courseid\n           WHERE b.filesize > ?\n                 {$sqlfilter}";
         $bigfilesize = $config->bigfilesize;
         $opts = array($bigfilesize * 1000000);
         $data = $DB->get_records_sql("SELECT concat(b.id, '-', a.id, '-', l.id) id,\n                                          b.url target,\n                                          b.filesize,\n                                          b.lastcrawled,\n                                          b.mimetype,\n                                          l.text,\n                                          a.title,\n                                          a.url,\n                                          a.redirect,\n                                          a.courseid,\n                                          c.shortname\n                                          {$sql}\n                                 ORDER BY b.filesize DESC,\n                                          l.text,\n                                          a.id", $opts, $start, $perpage);
         $count = $DB->get_field_sql("SELECT count(*) AS count" . $sql, $opts);
         $mdlw = strlen($CFG->wwwroot);