function ousearch_display_results($search, $baseurl, $title = null)
{
    if (debugging()) {
        $before = microtime(true);
    }
    $results = $search->query(optional_param('dbstart', 0, PARAM_INT), OUSEARCH_RESULTSPERPAGE);
    if (debugging()) {
        $searchtime = microtime(true) - $before;
    } else {
        $searchtime = null;
    }
    $query = stripslashes(required_param('query', PARAM_RAW));
    $from = optional_param('from', 0, PARAM_INT);
    $previous = optional_param('previous', '', PARAM_RAW);
    $linkshared = $baseurl . '&query=' . urlencode($query);
    $linkprev = null;
    $oldrange = null;
    $linknext = null;
    if ($results->success) {
        $matches = array();
        if ($from == OUSEARCH_RESULTSPERPAGE) {
            $linkprev = $linkshared;
        } else {
            if ($from > OUSEARCH_RESULTSPERPAGE && preg_match('/^(.*?),?([0-9]+)$/', $previous, $matches)) {
                $linkprev = $linkshared . '&from=' . ($from - OUSEARCH_RESULTSPERPAGE) . '&dbstart=' . $matches[2] . ($matches[1] ? '&previous=' . $matches[1] : '');
            }
        }
        $oldrange = $from - OUSEARCH_RESULTSPERPAGE + 1 . ' - ' . $from;
        if (count($results->results) == OUSEARCH_RESULTSPERPAGE) {
            if ($from < OUSEARCH_RESULTSPERPAGE) {
                $newprevious = '';
            } else {
                $newprevious = $previous !== '' ? '&previous=' . $previous . ',' : '&previous=';
                $newprevious .= required_param('dbstart', PARAM_INT);
            }
            $linknext = $linkshared . '&from=' . ($from + OUSEARCH_RESULTSPERPAGE) . '&dbstart=' . $results->dbstart . $newprevious;
        }
    }
    if ($title === null) {
        $title = get_string('searchresultsfor', 'block_ousearch', s($query));
    }
    print ousearch_format_results($results, $title, $from + 1, $linkprev, $oldrange, $linknext, $searchtime);
    return $results->success && count($results->results) > 0;
}
        $linknext = null;
        $linkprev = null;
        if ($results->success) {
            if ($page - FORUMNG_SEARCH_RESULTSPERPAGE + 1 > 0) {
                $linkprev = $url . "&action=1&page={$prevpage}" . $urloptions;
            }
            if ($results->numberofentries == FORUMNG_SEARCH_RESULTSPERPAGE) {
                $linknext = $url . "&action=1&page={$nextpage}" . $urloptions;
            }
        }
        if ($results->done === 1) {
            if ($page - FORUMNG_SEARCH_RESULTSPERPAGE + 1 > 0) {
                $linkprev = $url . "&action=1&page={$prevpage}" . $urloptions;
            }
        }
        print ousearch_format_results($results, $searchtitle, $page + 1, $linkprev, $prevrange, $linknext, $results->searchtime);
    }
} catch (forum_exception $e) {
    forum_utils::handle_exception($e);
}
print_footer($course);
////////////////////////////////////////////////////////////////////////////////
/**
 * Filter search result.
 * @param object $result
 * @return boolean
 */
function forumng_exclude_words_filter($result)
{
    $author = trim(optional_param('author', null, PARAM_RAW));
    $drfa = optional_param('daterangefrom', 0, PARAM_INT);