<?php

require '../modules/quizrooDB.php';
require '../modules/inc/class.stemmer.inc';
// check if query is blank
if (isset($_GET['searchQuery'])) {
    if ($_GET['searchQuery'] != "") {
        $currentPage = $_SERVER["PHP_SELF"];
        $searchQuery = $_GET['searchQuery'];
        // split it up into tokens
        // $tokenArray = explode(' ', $searchQuery);
        // prepare the Porter Stemmer
        $stemmer = new Stemmer();
        $tokenArray = $stemmer->stem_list($searchQuery);
        // search modifiers
        if (isset($_GET['searchType'])) {
            $searchType = $_GET['searchType'];
        } else {
            $searchType = 0;
        }
        if (isset($_GET['question_option'])) {
            $searchOption = $_GET['question_option'];
        } else {
            $searchOption = 0;
        }
        $maxRows_listQuiz = 10;
        $pageNum_listQuiz = 0;
        $maxPage_listQuiz = 10;
        // Maximum paging value
        if (isset($_GET['pageNum_listQuiz'])) {
            $pageNum_listQuiz = $_GET['pageNum_listQuiz'];