<commit_before><?php
    /**
     * Class: Leaf
     * Extends the Twig template engine.
     */
    class Leaf extends Twig_Extension {
        /**
         * Function: getName
         * Returns the name of the extension.
         */
        public function getName() {
            return "Leaf";
        }

        /**
         * Function: getFunctions
         * Returns a list of operators to add to the existing list.
         */
        public function getFunctions() {
            return array(   
                # Helpers
                new Twig_SimpleFunction("url",                 "url"),
                new Twig_SimpleFunction("admin_url",           "admin_url"),
                new Twig_SimpleFunction("self_url",            "self_url"),
                new Twig_SimpleFunction("module_enabled",      "module_enabled"),
                new Twig_SimpleFunction("feather_enabled",     "feather_enabled"),
                new Twig_SimpleFunction("password_strength",   "password_strength"),

                # Custom functions
                new Twig_SimpleFunction("paginate",             "twig_function_paginate")
            );
        }

        /**
         * Function: getFilters
         * Returns a list of filters to add to the existing list.
         */
        public function getFilters() {
            return array(   
                # Helpers
                new Twig_SimpleFilter("camelize",              "camelize"),
                new Twig_SimpleFilter("decamelize",            "decamelize"),
                new Twig_SimpleFilter("normalize",             "normalize"),
                new Twig_SimpleFilter("truncate",              "truncate"),
                new Twig_SimpleFilter("pluralize",             "pluralize"),
                new Twig_SimpleFilter("depluralize",           "depluralize"),
                new Twig_SimpleFilter("oneof",                 "oneof"),
                new Twig_SimpleFilter("fix",                   "fix"),
                new Twig_SimpleFilter("sanitize",              "sanitize"),
                new Twig_SimpleFilter("sanitize_html",         "sanitize_html"),
                new Twig_SimpleFilter("token",                 "token"),
                new Twig_SimpleFilter("uploaded",              "uploaded"),
                new Twig_SimpleFilter("gravatar",              "get_gravatar"),

                # Custom filters
                new Twig_SimpleFilter("translate",             "twig_filter_translate"),
                new Twig_SimpleFilter("translate_plural",      "twig_filter_translate_plural"),
                new Twig_SimpleFilter("translate_search",      "twig_filter_translate_search"),
                new Twig_SimpleFilter("strftimeformat",        "twig_filter_strftime_format"),
                new Twig_SimpleFilter("filesizeformat",        "twig_filter_filesize_format"),
                new Twig_SimpleFilter("repeat",                "twig_filter_repeat"),
                new Twig_SimpleFilter("match",                 "twig_filter_match"),
                new Twig_SimpleFilter("contains",              "twig_filter_contains"),
                new Twig_SimpleFilter("inspect",               "twig_filter_inspect"),
                new Twig_SimpleFilter("selected",              "twig_filter_selected"),
                new Twig_SimpleFilter("checked",               "twig_filter_checked"),
                new Twig_SimpleFilter("download",              "twig_filter_download")
            );
        }
    }

    /**
     * Function: twig_callback_missing_function
     * Scans enabled modules for a callable method matching the name of a missing Twig function.
     */
    function twig_callback_missing_function($name) {
        foreach (Modules::$instances as $module)
            if (is_callable(array($module, $name)))
                return new Twig_SimpleFunction($name, get_class($module)."::".$name);

        return false;
    }

    /**
     * Function: twig_callback_missing_filter
     * Scans enabled modules for a callable method matching the name of a missing Twig filter.
     */
    function twig_callback_missing_filter($name) {
        foreach (Modules::$instances as $module)
            if (is_callable(array($module, $name)))
                return new Twig_SimpleFilter($name, get_class($module)."::".$name);

        return false;
    }

    /**
     * Function: twig_function_paginate
     * Paginates an array of items using the Paginator class.
     */
    function twig_function_paginate($array, $per_page, $name = "page") {
            $name = str_replace("_", "", $name)."_page"; # This is important for clean URL parsing.

        if (in_array($name, Paginator::$names))
            $name = count(Paginator::$names).$name;

        return new Paginator($array, $per_page, $name);
    }

    /**<commit_msg>Leaf: setting a per page default for paginate filter<commit_after><?php
    /**
     * Class: Leaf
     * Extends the Twig template engine.
     */
    class Leaf extends Twig_Extension {
        /**
         * Function: getName
         * Returns the name of the extension.
         */
        public function getName() {
            return "Leaf";
        }

        /**
         * Function: getFunctions
         * Returns a list of operators to add to the existing list.
         */
        public function getFunctions() {
            return array(   
                # Helpers
                new Twig_SimpleFunction("url",                 "url"),
                new Twig_SimpleFunction("admin_url",           "admin_url"),
                new Twig_SimpleFunction("self_url",            "self_url"),
                new Twig_SimpleFunction("module_enabled",      "module_enabled"),
                new Twig_SimpleFunction("feather_enabled",     "feather_enabled"),
                new Twig_SimpleFunction("password_strength",   "password_strength"),

                # Custom functions
                new Twig_SimpleFunction("paginate",             "twig_function_paginate")
            );
        }

        /**
         * Function: getFilters
         * Returns a list of filters to add to the existing list.
         */
        public function getFilters() {
            return array(   
                # Helpers
                new Twig_SimpleFilter("camelize",              "camelize"),
                new Twig_SimpleFilter("decamelize",            "decamelize"),
                new Twig_SimpleFilter("normalize",             "normalize"),
                new Twig_SimpleFilter("truncate",              "truncate"),
                new Twig_SimpleFilter("pluralize",             "pluralize"),
                new Twig_SimpleFilter("depluralize",           "depluralize"),
                new Twig_SimpleFilter("oneof",                 "oneof"),
                new Twig_SimpleFilter("fix",                   "fix"),
                new Twig_SimpleFilter("sanitize",              "sanitize"),
                new Twig_SimpleFilter("sanitize_html",         "sanitize_html"),
                new Twig_SimpleFilter("token",                 "token"),
                new Twig_SimpleFilter("uploaded",              "uploaded"),
                new Twig_SimpleFilter("gravatar",              "get_gravatar"),

                # Custom filters
                new Twig_SimpleFilter("translate",             "twig_filter_translate"),
                new Twig_SimpleFilter("translate_plural",      "twig_filter_translate_plural"),
                new Twig_SimpleFilter("translate_search",      "twig_filter_translate_search"),
                new Twig_SimpleFilter("strftimeformat",        "twig_filter_strftime_format"),
                new Twig_SimpleFilter("filesizeformat",        "twig_filter_filesize_format"),
                new Twig_SimpleFilter("repeat",                "twig_filter_repeat"),
                new Twig_SimpleFilter("match",                 "twig_filter_match"),
                new Twig_SimpleFilter("contains",              "twig_filter_contains"),
                new Twig_SimpleFilter("inspect",               "twig_filter_inspect"),
                new Twig_SimpleFilter("selected",              "twig_filter_selected"),
                new Twig_SimpleFilter("checked",               "twig_filter_checked"),
                new Twig_SimpleFilter("download",              "twig_filter_download")
            );
        }
    }

    /**
     * Function: twig_callback_missing_function
     * Scans enabled modules for a callable method matching the name of a missing Twig function.
     */
    function twig_callback_missing_function($name) {
        foreach (Modules::$instances as $module)
            if (is_callable(array($module, $name)))
                return new Twig_SimpleFunction($name, get_class($module)."::".$name);

        return false;
    }

    /**
     * Function: twig_callback_missing_filter
     * Scans enabled modules for a callable method matching the name of a missing Twig filter.
     */
    function twig_callback_missing_filter($name) {
        foreach (Modules::$instances as $module)
            if (is_callable(array($module, $name)))
                return new Twig_SimpleFilter($name, get_class($module)."::".$name);

        return false;
    }

    /**
     * Function: twig_function_paginate
     * Paginates an array of items using the Paginator class.
     */
    function twig_function_paginate($array, $per_page = 10, $name = "page") {
            $name = str_replace("_", "", $name)."_page"; # This is important for clean URL parsing.

        if (in_array($name, Paginator::$names))
            $name = count(Paginator::$names).$name;

        return new Paginator($array, $per_page, $name);
    }

    /**
{'fraction_non_alphanumeric': 0.09891013777503599, 'fraction_numerical': 0.00020563438206868187, 'mean_word_length': 1.7641375390736005, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1323116', 'n_tokens_mistral': 2554, 'n_tokens_neox': 2437, 'n_words': 535}