<commit_before><?php

namespace SystemInc\LaravelAdmin\Traits;

trait HelpersTrait
{
    public function sanitizeUri($uri)
    {
        return trim(strtolower(preg_replace(['/[^a-zA-Z0-9-\/]/', '/\/+/', '/-+/'], ['', '/', '-'], $uri)), '/-');
    }

    public function sanitizeUriKey($uri_key)
    {
        return trim(strtolower(preg_replace(['/[^a-zA-Z0-9-]/', '/-+/'], ['', '-'], $uri_key)), '-');
    }

    public function sanitizeElements($element)
    {
        return trim(strtolower(preg_replace('/[^a-zA-Z0-9_]/', '', $element)), '_');
    }
}<commit_msg>generate Nested Page List trait<commit_after><?php

namespace SystemInc\LaravelAdmin\Traits;

trait HelpersTrait
{
    public function sanitizeUri($uri)
    {
        return trim(strtolower(preg_replace(['/[^a-zA-Z0-9-\/]/', '/\/+/', '/-+/'], ['', '/', '-'], $uri)), '/-');
    }

    public function sanitizeUriKey($uri_key)
    {
        return trim(strtolower(preg_replace(['/[^a-zA-Z0-9-]/', '/-+/'], ['', '-'], $uri_key)), '-');
    }

    public function sanitizeElements($element)
    {
        return trim(strtolower(preg_replace('/[^a-zA-Z0-9_]/', '', $element)), '_');
    }
    
    public function generateNestedPageList($pages, $navigation = '')
    {
        $navigation .= '<ul>';

        foreach ($pages as $page) {
            $navigation .= '<li>';
            $navigation .= '<a href="pages/edit/'.$page->id.'"><b>'.$page->title.'</a>';

            if ($page->subpages()->count()) {
                $navigation = $this->generateNestedPageList($page->subpages(), $navigation);
            }

            $navigation .= '</li>';
        }
        
        $navigation .= '</ul>';

        return $navigation;
    }
}
{'fraction_non_alphanumeric': 0.24075161479741633, 'fraction_numerical': 0.007046388725778039, 'mean_word_length': 2.4285714285714284, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, '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': '4899894', 'n_tokens_mistral': 592, 'n_tokens_neox': 567, 'n_words': 76}