<commit_before><?php

class AdminController extends \BaseController {

    function getIndex()
    {
        return View::make('admin.index');
    }

    function getMemeAdd(){
        return View::make('admin.meme.add');
    }

    function postMemeAdd(){
        //przyjmij plik
        if (!Input::hasFile('meme'))
        {
            return Redirect::to('/a/meme/add')->with('error', 'Nie dodano pliku!');
        }

        //zapisz
        //zmien nazwe
        $filename = Helper::getRandomString().'.'.Input::file('meme')->getClientOriginalExtension();
        Input::file('meme')->move(storage_path().'/memes/', $filename);

        //dodaj do bazy
        $meme = Meme::create([
            'filename' => $filename,
            'name' => Input::get('title'),
            'description' => Input::get('description')
        ]);
        //wygeneruj kody
//        $codes = [];
//        foreach(range(1, Input::get('code_amount')) as $index){
//            $code = Helper::getRandomString(20);
//            $codes[$index] = $code;
//            Code::create([
//                'code' => $code,
//                'meme_id' => $meme->id,
//                'used' => 0
//            ]);
//        }
        $hashids = new Hashids\Hashids(Config::get('app.key'), 8);
        $id = $hashids->encode($meme->id);
        //zwroc link
        return View::make('admin.meme.add')->with('message', 'Dodano! Mem dostępny pod adresem '.URL::to('v/'.$id));
    }

    function getMemeList(){
        $memes = Meme::all();

        if($memes->isEmpty()){
            return Redirect::to('a')->with('error', 'Nie ma jeszcze memów!');<commit_msg>Cleanup comments<commit_after><?php

class AdminController extends \BaseController {

    function getIndex()
    {
        return View::make('admin.index');
    }

    function getMemeAdd(){
        return View::make('admin.meme.add');
    }

    function postMemeAdd(){
        //przyjmij plik
        if (!Input::hasFile('meme'))
        {
            return Redirect::to('/a/meme/add')->with('error', 'Nie dodano pliku!');
        }

        //Change name
        $filename = Helper::getRandomString().'.'.Input::file('meme')->getClientOriginalExtension();

        //Save
        Input::file('meme')->move(storage_path().'/memes/', $filename);

        //Add to database
        $meme = Meme::create([
            'filename' => $filename,
            'name' => Input::get('title'),
            'description' => Input::get('description')
        ]);

        $hashids = new Hashids\Hashids(Config::get('app.key'), 8);
        $id = $hashids->encode($meme->id);
        //Return link
        return View::make('admin.meme.add')->with('message', 'Dodano! Mem dostępny pod adresem '.URL::to('v/'.$id));
    }

    function getMemeList(){
        $memes = Meme::all();

        if($memes->isEmpty()){
            return Redirect::to('a')->with('error', 'Nie ma jeszcze memów!');
{'fraction_non_alphanumeric': 0.19458718739294278, 'fraction_numerical': 0.0020554984583761563, 'mean_word_length': 2.139784946236559, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '1668504', 'n_tokens_mistral': 922, 'n_tokens_neox': 903, 'n_words': 156}