<commit_before><?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Hogwarts extends Application
{

    function __construct()
    {
            parent::__construct();
    }

    /**
     * Homepage for our app
     */
    public function index()
    {
        // this is the view we want shown
        $this->data['pagebody'] = 'homepage';

        // build the list of authors, to pass on to our view
        $source = $this->quotes->all();
        $authors = array ();
        foreach ($source as $record)
        {
                $authors[] = array ('who' => $record['who'], 'mug' => $record['mug'], 'href' => $record['where']);
        }
        $this->data['authors'] = $authors;

        $this->render();
    }

    public function shucks() {

        $this->data['pagebody'] = 'justone';

        $record = $this->quotes->get(2);                

        $this->data = array_merge($this->data, $record);

        $this->render();
    }
    
    public function random() {
        $this->data['pagebody'] = 'justone';
        
        $source = $this->quotes->all();
        $authors = array();
        
        $count = count($source);
        $index = rand(0, $count-1);
        $record = $source[$index];
        
        $this->data = array_merge($this->data, $record);
        $this->render();
    }<commit_msg>added comments to the random() function<commit_after><?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Hogwarts extends Application
{

    function __construct()
    {
            parent::__construct();
    }

    /**
     * Homepage for our app
     */
    public function index()
    {
        // this is the view we want shown
        $this->data['pagebody'] = 'homepage';

        // build the list of authors, to pass on to our view
        $source = $this->quotes->all();
        $authors = array ();
        foreach ($source as $record)
        {
                $authors[] = array ('who' => $record['who'], 'mug' => $record['mug'], 'href' => $record['where']);
        }
        $this->data['authors'] = $authors;

        $this->render();
    }

    public function shucks() {

        $this->data['pagebody'] = 'justone';

        $record = $this->quotes->get(2);                

        $this->data = array_merge($this->data, $record);

        $this->render();
    }
    
    public function random() {
        // this is the view we want shown
        $this->data['pagebody'] = 'justone';
        
        // build the list o authors, to pass on to our view
        $source = $this->quotes->all();
        $authors = array();
        
        // select a random number and retrieve the quote corresponding to the number
        $count = count($source);
        $index = rand(0, $count-1);
        $record = $source[$index];
        
        $this->data = array_merge($this->data, $record);
        $this->render();
    }
{'fraction_non_alphanumeric': 0.16454826520096186, 'fraction_numerical': 0.0020611473720371005, 'mean_word_length': 1.9032901296111664, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '3294161', 'n_tokens_mistral': 857, 'n_tokens_neox': 825, 'n_words': 219}