<commit_before><?php

namespace BookStack\Http\Controllers;

use BookStack\Actions\Activity;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class AuditLogController extends Controller
{
    public function index(Request $request)
    {
        $this->checkPermission('settings-manage');
        $this->checkPermission('users-manage');

        $listDetails = [
            'order'     => $request->get('order', 'desc'),
            'event'     => $request->get('event', ''),
            'sort'      => $request->get('sort', 'created_at'),
            'date_from' => $request->get('date_from', ''),
            'date_to'   => $request->get('date_to', ''),
            'user'      => $request->get('user', ''),
            'ip'        => $request->get('ip', ''),
        ];

        $query = Activity::query()
            ->with([
                'entity' => function ($query) {
                    $query->withTrashed();
                },
                'user',
            ])
            ->orderBy($listDetails['sort'], $listDetails['order']);

        if ($listDetails['event']) {
            $query->where('type', '=', $listDetails['event']);
        }
        if ($listDetails['user']) {
            $query->where('user_id', '=', $listDetails['user']);
        }

        if ($listDetails['date_from']) {
            $query->where('created_at', '>=', $listDetails['date_from']);
        }
        if ($listDetails['date_to']) {
            $query->where('created_at', '<=', $listDetails['date_to']);
        }
        if ($listDetails['ip']) {
            $query->where('ip', 'like', $listDetails['ip'] . "%");
        }

        $activities = $query->paginate(100);
        $activities->appends($listDetails);

        $types = DB::table('activities')->select('type')->distinct()->pluck('type');
        $this->setPageTitle(trans('settings.audit'));

        return view('settings.audit', [
            'activities'    => $activities,
            'listDetails'   => $listDetails,
            'activityTypes' => $types,
        ]);
    }
}
<commit_msg>Fix PHP CS<commit_after><?php

namespace BookStack\Http\Controllers;

use BookStack\Actions\Activity;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class AuditLogController extends Controller
{
    public function index(Request $request)
    {
        $this->checkPermission('settings-manage');
        $this->checkPermission('users-manage');

        $listDetails = [
            'order'     => $request->get('order', 'desc'),
            'event'     => $request->get('event', ''),
            'sort'      => $request->get('sort', 'created_at'),
            'date_from' => $request->get('date_from', ''),
            'date_to'   => $request->get('date_to', ''),
            'user'      => $request->get('user', ''),
            'ip'        => $request->get('ip', ''),
        ];

        $query = Activity::query()
            ->with([
                'entity' => function ($query) {
                    $query->withTrashed();
                },
                'user',
            ])
            ->orderBy($listDetails['sort'], $listDetails['order']);

        if ($listDetails['event']) {
            $query->where('type', '=', $listDetails['event']);
        }
        if ($listDetails['user']) {
            $query->where('user_id', '=', $listDetails['user']);
        }

        if ($listDetails['date_from']) {
            $query->where('created_at', '>=', $listDetails['date_from']);
        }
        if ($listDetails['date_to']) {
            $query->where('created_at', '<=', $listDetails['date_to']);
        }
        if ($listDetails['ip']) {
            $query->where('ip', 'like', $listDetails['ip'] . '%');
        }

        $activities = $query->paginate(100);
        $activities->appends($listDetails);

        $types = DB::table('activities')->select('type')->distinct()->pluck('type');
        $this->setPageTitle(trans('settings.audit'));

        return view('settings.audit', [
            'activities'    => $activities,
            'listDetails'   => $listDetails,
            'activityTypes' => $types,
        ]);
    }
}

{'fraction_non_alphanumeric': 0.20159151193633953, 'fraction_numerical': 0.0014468290330359296, 'mean_word_length': 2.0840148698884757, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 73, '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': '2129009', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1182, 'n_words': 164}