<commit_before><cfscript>
    function strLimit( str, limit, ending = "..." ) {
        if ( len( str ) <= limit ) {
            return str;
        }
        return mid( str, 1, limit ) & ending;
    }

    function isScriptFile( path ) {
        return application.wirebox.getInstance(
            name = "File@CFMLParser",
            initArguments = { path = path }
        ).isScript();
    }
</cfscript>

<cfset local.e = oException.getExceptionStruct() />
<cfset stackFrames = arrayLen( local.e.TagContext ) />

<cfoutput>
    <html>
    <head>
        <title>Whoops! An error occurred.</title>
        <link href="https://fonts.googleapis.com/css?family=Fira+Mono|Lato" rel="stylesheet">
        <script type="text/javascript" src="#event.getModuleRoot( "whoops" )#/includes/js/syntaxhighlighter.js"></script>
        <link type="text/css" rel="stylesheet" href="#event.getModuleRoot( "whoops" )#/includes/css/syntaxhighlighter-theme.css">
        <link type="text/css" rel="stylesheet" href="#event.getModuleRoot( "whoops" )#/includes/css/whoops.css">
    </head>
    <body>
        <div class="whoops">
            <div class="whoops__nav">
                <div class="exception">
                    <h1 class="exception__title">#local.e.type#</h1>
                    <h2 class="exception__message">#local.e.message#</h2>
                </div>
                <div class="whoops_stacktrace_panel_info">
                    Stack Frame(s): #stackFrames#
                </div>
                <div class="whoops__stacktrace_panel">
                    <ul class="stacktrace__list">
                        <cfset root = expandPath( "/" ) />
                        <cfloop array="#local.e.TagContext#" index="i" item="instance">
                            <li id="stack#stackFrames - i + 1#" class="stacktrace <cfif i == 1>stacktrace--active</cfif>">
                                <span class="badge">#stackFrames - i + 1#</span>
                                <div class="stacktrace__info">
                                    <h3 class="stacktrace__location">
                                        #replace( instance.template, root, "" )#:<span class="stacktrace__line-number">#instance.line#</span>
                                    </h3>
                                    <h4 class="stacktrace__code">
                                        #HTMLEditFormat( strLimit( instance.codePrintPlain, 70 ) )#
                                    </h4>
                                </div>
                            </li>
                        </cfloop>
                    </ul>
                </div>
            </div>
            <div class="whoops__detail">
                <div class="code-preview">
                    <cfset instance = local.e.TagContext[ 1 ] />
                    <div id="code-container"></div>
                </div>
                <div class="request-info">
                    <h1>Request Details</h1>
                    <div>
                        <h2>rc</h2>
                        <cfdump var="#rc#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>prc</h2>
                        <cfdump var="#prc#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>Headers</h2>
                        <cfdump var="#getHttpRequestData().headers#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>session</h2>
                        <cfdump var="#session#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>application</h2>
                        <cfdump var="#application#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>cookies</h2>
                        <cfdump var="#cookie#" top="2" expand="false" />
                    </div>
                </div>
            </div>
        </div>
        <cfloop array="#local.e.TagContext#" index="i" item="instance">
            <cfset highlighter = isScriptFile( instance.template ) ? "js" : "cf" />
            <div id="stack#stackFrames - i + 1#-code" data-highlight-line="#instance.line#" style="display: none;">
                <script type="text/syntaxhighlighter" class="brush: #highlighter#; highlight: [#instance.line#]"><![CDATA[#lTrim( fileRead( instance.template ) )#]]></script>
            </div>
        </cfloop>
        <script src="#event.getModuleRoot( "whoops" )#/includes/js/whoops.js"></script>
    </body>
    </html>
</cfoutput>
<commit_msg>ACF compaitiblity<commit_after><cfscript>
    if ( ! structKeyExists( variables, "strLimit" ) ) {
        function strLimit( str, limit, ending = "..." ) {
            if ( len( str ) <= limit ) {
                return str;
            }
            return mid( str, 1, limit ) & ending;
        }
    }
    
    if ( ! structKeyExists( variables, "isScriptFile" ) ) {
        function isScriptFile( path ) {
            return application.wirebox.getInstance(
                name = "File@CFMLParser",
                initArguments = { path = path }
            ).isScript();
        }
    }
</cfscript>

<cfset local.e = oException.getExceptionStruct() />
<cfset stackFrames = arrayLen( local.e.TagContext ) />

<cfoutput>
    <html>
    <head>
        <title>Whoops! An error occurred.</title>
        <link href="https://fonts.googleapis.com/css?family=Fira+Mono|Lato" rel="stylesheet">
        <script type="text/javascript" src="#event.getModuleRoot( "whoops" )#/includes/js/syntaxhighlighter.js"></script>
        <link type="text/css" rel="stylesheet" href="#event.getModuleRoot( "whoops" )#/includes/css/syntaxhighlighter-theme.css">
        <link type="text/css" rel="stylesheet" href="#event.getModuleRoot( "whoops" )#/includes/css/whoops.css">
    </head>
    <body>
        <div class="whoops">
            <div class="whoops__nav">
                <div class="exception">
                    <h1 class="exception__title">#local.e.type#</h1>
                    <h2 class="exception__message">#local.e.message#</h2>
                </div>
                <div class="whoops_stacktrace_panel_info">
                    Stack Frame(s): #stackFrames#
                </div>
                <div class="whoops__stacktrace_panel">
                    <ul class="stacktrace__list">
                        <cfset root = expandPath( "/" ) />
                        <cfloop from="1" to="#arrayLen( local.e.TagContext )#" index="i">
                            <cfset instance = local.e.TagContext[ i ] />
                            <li id="stack#stackFrames - i + 1#" class="stacktrace <cfif i EQ 1>stacktrace--active</cfif>">
                                <span class="badge">#stackFrames - i + 1#</span>
                                <div class="stacktrace__info">
                                    <h3 class="stacktrace__location">
                                        #replace( instance.template, root, "" )#:<span class="stacktrace__line-number">#instance.line#</span>
                                    </h3>
                                    <cfif structKeyExists( instance, "codePrintPlain" )>
                                        <h4 class="stacktrace__code">
                                            #HTMLEditFormat( strLimit( instance.codePrintPlain, 70 ) )#
                                        </h4>
                                    </cfif>
                                </div>
                            </li>
                        </cfloop>
                    </ul>
                </div>
            </div>
            <div class="whoops__detail">
                <div class="code-preview">
                    <cfset instance = local.e.TagContext[ 1 ] />
                    <div id="code-container"></div>
                </div>
                <div class="request-info">
                    <h1>Request Details</h1>
                    <div>
                        <h2>rc</h2>
                        <cfdump var="#rc#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>prc</h2>
                        <cfdump var="#prc#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>Headers</h2>
                        <cfdump var="#getHttpRequestData().headers#" top="2" expand="false" />
                    </div>
                    <cftry>
                        <cfset thisSession = session />
                        <div>
                            <h2>session</h2>
                                <cfdump var="#thisSession#" top="2" expand="false" />
                        </div>
                        <cfcatch></cfcatch>
                    </cftry>
                    <div>
                        <h2>application</h2>
                        <cfdump var="#application#" top="2" expand="false" />
                    </div>
                    <div>
                        <h2>cookies</h2>
                        <cfdump var="#cookie#" top="2" expand="false" />
                    </div>
                </div>
            </div>
        </div>
        <cfloop from="1" to="#arrayLen( local.e.TagContext )#" index="i">
            <cfset instance = local.e.TagContext[ i ] />
            <cfset highlighter = isScriptFile( instance.template ) ? "js" : "cf" />
            <div id="stack#stackFrames - i + 1#-code" data-highlight-line="#instance.line#" style="display: none;">
                <script type="text/syntaxhighlighter" class="brush: #highlighter#; highlight: [#instance.line#]"><![CDATA[#lTrim( fileRead( instance.template ) )#]]></script>
            </div>
        </cfloop>
        <script src="#event.getModuleRoot( "whoops" )#/includes/js/whoops.js"></script>
    </body>
    </html>
</cfoutput>
{'fraction_non_alphanumeric': 0.14456620086458227, 'fraction_numerical': 0.007439428973559867, 'mean_word_length': 1.2790378006872851, 'pattern_counts': {'":': 0, '<': 220, '<?xml version=': 0, '>': 218, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7612689', 'n_tokens_mistral': 2815, 'n_tokens_neox': 2648, 'n_words': 479}