<commit_before><?php

namespace FluxBB\Actions;

use FluxBB\Core\Action;
use FluxBB\Models\CategoryRepository;
use Illuminate\Support\Str;

class ViewCategory extends Action
{
    protected $categories;


    public function __construct(CategoryRepository $repository)
    {
        $this->categories = $repository;
    }

    protected function run()
    {
        $slug = $this->request->get('slug');
        $slug = '/'.Str::finish(trim($slug, '/'), '/');

        $category = $this->categories->findBySlug($slug);

        $this->data['category'] = $category;
        $this->data['categories'] = $this->categories->getByParent($slug);
        $this->data['conversations'] = $this->categories->getConversationsIn($category);
    }
}
<commit_msg>Remove duplicate slashes from category name.<commit_after><?php

namespace FluxBB\Actions;

use FluxBB\Core\Action;
use FluxBB\Models\CategoryRepository;

class ViewCategory extends Action
{
    protected $categories;


    public function __construct(CategoryRepository $repository)
    {
        $this->categories = $repository;
    }

    protected function run()
    {
        $slug = $this->request->get('slug');
        $slug = preg_replace('/\/+/', '/', '/'.$slug.'/');

        $category = $this->categories->findBySlug($slug);

        $this->data['category'] = $category;
        $this->data['categories'] = $this->categories->getByParent($slug);
        $this->data['conversations'] = $this->categories->getConversationsIn($category);
    }
}

{'fraction_non_alphanumeric': 0.16644474034620507, 'fraction_numerical': 0.0, 'mean_word_length': 3.4205882352941175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '911938', 'n_tokens_mistral': 442, 'n_tokens_neox': 447, 'n_words': 76}