#Only send text
header("Content-type: text/plain");
#Make sure that we are doing something...
if (isset($_GET['act'])) {
    switch ($_GET['act']) {
        #Populate folder
        case 1:
            echo "Populating folder with elements\n";
            #Loop through the number of elements we want
            for ($i = 0; $i < (isset($_GET['num']) && is_numeric($_GET['num']) && $_GET['num'] > 0 ? $_GET['num'] : 30); $i++) {
                #Generate a random string, number and date
                $randName = substr($lipsum, rand(0, (int) (strlen($lipsum) / 2)), rand((int) (strlen($lipsum) / 10), (int) (strlen($lipsum) / 2)));
                $randNumber = rand();
                $randDate = date('m-d', rand(time() - 5 * 365 * 24 * 60 * 60, time()));
                #Add into the entry list
                $logger->addEntry(array('name' => $randName, 'number' => $randNumber, 'date' => $randDate));
                echo "\tAdded element with string: " . $randName . '|' . $randNumber . '|' . $randDate . "\n";
            }
            #Write all entries into the working log directory
            $logger->writeLogToFiles();
            echo "Wrote elements to file!\n";
            #Check for errors
            $errors = $logger->returnErrors();
            if (count($errors) > 0) {
                echo "\nERRORS ENCOUNTERED!\n";
                for ($o = 0; $o < count($errors); $o++) {
                    echo "\t" . $errors[$o] . "\n";
                }
            }
            break;
            #Parse folder and store in DB