<commit_before>(function () {
    var cogClass = function () {};
    cogClass.prototype.exec = function (params, request, response) {

        console.log("HELLO");

        var oops = this.utils.apiError;
        var sys = this.sys;
        var classID = params.classid;
        var quizNumber = params.quizno;
        var studentID = params.studentid;
        var page = this.page.toString();
        var altpage = this.altpage.toString();
        var errpage = this.errpage;

        console.log("Errpage: "+errpage);

        sys.db.get('SELECT qz.examName,c.name AS className FROM classes AS c LEFT JOIN quizzes AS qz ON c.classID=qz.classID WHERE qz.classID=? AND qz.quizNumber=?',[classID,quizNumber],function(err,row){
            if (err) {return oops(response,err,'*quiz(1)')};
            if (row) {
                getQuizOrResult(row.className,row.examName);
            } else {
                response.writeHead(404, {'Content-Type': 'text/html'});
                response.end(errpage);
            }
        });
        
        function getQuizOrResult(className,examName) {
            sys.db.get('SELECT s.name AS studentName,c.name AS className FROM answers AS a JOIN students AS s ON s.studentID=a.studentID JOIN classes AS c ON c.classID=a.classID WHERE a.classID=? AND a.quizNumber=? AND a.studentID=?',[classID,quizNumber,studentID],function(err,row){
                if (err) {return oops(response,err,'*quiz(2)')}
                var quizLabel;
                if (examName) {
                    quizLabel = examName;
                } else {
                    quizLabel = 'Quiz ' + quizNumber;
                }<commit_msg>Return error page that is defined<commit_after>(function () {
    var cogClass = function () {};
    cogClass.prototype.exec = function (params, request, response) {

        console.log("HELLO");

        var oops = this.utils.apiError;
        var sys = this.sys;
        var classID = params.classid;
        var quizNumber = params.quizno;
        var studentID = params.studentid;
        var page = this.page.toString();
        var altpage = this.altpage.toString();
        var errpage = '<html>\n'
            + '<head><title>Page removed</title></head><body><h1>Our apologies!</h1><p>This page has been removed. Sorry for the inconvenience.</p></body></html>';

        console.log("Errpage: "+errpage);

        sys.db.get('SELECT qz.examName,c.name AS className FROM classes AS c LEFT JOIN quizzes AS qz ON c.classID=qz.classID WHERE qz.classID=? AND qz.quizNumber=?',[classID,quizNumber],function(err,row){
            if (err) {return oops(response,err,'*quiz(1)')};
            if (row) {
                getQuizOrResult(row.className,row.examName);
            } else {
                response.writeHead(404, {'Content-Type': 'text/html'});
                response.end(errpage);
            }
        });
        
        function getQuizOrResult(className,examName) {
            sys.db.get('SELECT s.name AS studentName,c.name AS className FROM answers AS a JOIN students AS s ON s.studentID=a.studentID JOIN classes AS c ON c.classID=a.classID WHERE a.classID=? AND a.quizNumber=? AND a.studentID=?',[classID,quizNumber,studentID],function(err,row){
                if (err) {return oops(response,err,'*quiz(2)')}
                var quizLabel;
                if (examName) {
                    quizLabel = examName;
                } else {
                    quizLabel = 'Quiz ' + quizNumber;
                }
{'fraction_non_alphanumeric': 0.12718418791177313, 'fraction_numerical': 0.0034374104841019765, 'mean_word_length': 2.1687840290381124, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '89279', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1044, 'n_words': 238}