<commit_before><?php
namespace pharen\debug;
function convert_line_num($line_map, $errline){
    $pharen_line = 1;
    foreach($line_map as $php_line=>$ph_line){
        if($php_line >= $errline){
            $pharen_line = $ph_line;
            break;
        }
    }
    return $pharen_line;
}

function generate_pharen_err($file, $line, $msg){
    return "$msg in $file:$line\n";
}

function error_handler($errno, $errstr, $errfile, $errline, $errctx){
    $line_map = get_line_map();
    $pharen_file = basename($errfile, ".php").".phn";
    $pharen_line = convert_line_num($line_map, $errline);<commit_msg>Fix bug where it would default to a matching line number of 1.<commit_after><?php
namespace pharen\debug;
function convert_line_num($line_map, $errline){
    foreach($line_map as $php_line=>$ph_line){
        $pharen_line = $ph_line;
        if($php_line >= $errline){
            break;
        }
    }
    return $pharen_line;
}

function generate_pharen_err($file, $line, $msg){
    return "$msg in $file:$line\n";
}

function error_handler($errno, $errstr, $errfile, $errline, $errctx){
    $line_map = get_line_map();
    $pharen_file = basename($errfile, ".php").".phn";
    $pharen_line = convert_line_num($line_map, $errline);
{'fraction_non_alphanumeric': 0.15421686746987953, 'fraction_numerical': 0.001606425702811245, 'mean_word_length': 3.810810810810811, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2052507', 'n_tokens_mistral': 447, 'n_tokens_neox': 446, 'n_words': 89}