<commit_before><?php
/*
Name: Link Checker
Author: <NAME>
Author URI: http://about.me/renemari.padillo
Version: 1.1.0
License: MIT
*/

if ( isset($_POST["data"]) ) {
    if ( $_FILES["file"]["type"] != "application/octet-stream" && $_FILES["file"]["type"] != "text/plain" )
        echo "Invalid file type";
    else {
        $data = $_POST["data"];
        $file = $_FILES["file"];
        // Throw away after copying...
        unset($_POST["data"]);
        unset($_FILES["file"]);

        // $file = fopen("links", "r");
        // $output = fopen("output", "w");

        if ( $file["error"] !== UPLOAD_ERR_OK && ! is_uploaded_file($file["tmp_name"]) )
            echo "File link doesn't exist.";
        else {
            require_once("link-checker.php");

            ini_set('max_execution_time', 0); // Remove the execution timeout to allow our script to run when checking many links
            
            $uploadDest = __DIR__.'/links';

            move_uploaded_file($file["tmp_name"], $uploadDest);
            
            $fstream = fopen($uploadDest, "r");
            $output = fopen("output.txt", "w");;

            // print_r($fstream);
            // print_r($uploadDest);
            // exit();

            //
            // Start Checking
            //
            while ( ! feof($fstream) ) {
                $link = fgets($fstream);

                if ( $link !== FALSE ) {
                    $result = null;<commit_msg>* Code cleaning<commit_after><?php
/*
Name: Link Checker
Author: <NAME>
Author URI: http://about.me/renemari.padillo
Version: 1.1.0
License: MIT
*/

if ( isset($_POST["data"]) ) {
    if ( $_FILES["file"]["type"] != "application/octet-stream" && $_FILES["file"]["type"] != "text/plain" )
        echo "Invalid file type";
    else {
        $data = $_POST["data"];
        $file = $_FILES["file"];
        // Throw away after copying...
        unset($_POST["data"]);
        unset($_FILES["file"]);

        if ( $file["error"] !== UPLOAD_ERR_OK && ! is_uploaded_file($file["tmp_name"]) )
            echo "File link doesn't exist.";
        else {
            require_once("link-checker.php");

            ini_set('max_execution_time', 0); // Remove the execution timeout to allow our script to run when checking many links
            
            $uploadDest = __DIR__.'/links';
            // remove duplicate upload
            if ( file_exists($uploadDest) )
                unlink($uploadDest);

            move_uploaded_file($file["tmp_name"], $uploadDest);
            
            $fstream = fopen($uploadDest, "r");
            $output = fopen("output.txt", "w");;
            //
            // Start Checking
            //
            while ( ! feof($fstream) ) {
                $link = fgets($fstream);

                if ( $link !== FALSE ) {
                    $result = null;
{'fraction_non_alphanumeric': 0.16993693062368606, 'fraction_numerical': 0.002803083391730904, 'mean_word_length': 1.8295341922695738, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '2413940', 'n_tokens_mistral': 852, 'n_tokens_neox': 832, 'n_words': 182}