@php
    $paginator = $paginator ?? $items ?? null;
@endphp
@if($paginator)
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2 p-3 pt-0">
    <form method="get" class="d-flex align-items-center gap-2">
        @foreach(request()->except(['per_page', 'page']) as $key => $value)
            @if(is_array($value))
                @foreach($value as $item)
                    <input type="hidden" name="{{ $key }}[]" value="{{ $item }}">
                @endforeach
            @else
                <input type="hidden" name="{{ $key }}" value="{{ $value }}">
            @endif
        @endforeach
        <label class="small text-muted mb-0">{{ __('messages.per_page') }}</label>
        <select name="per_page" class="form-select form-select-sm" style="width:auto" onchange="this.form.submit()">
            @foreach([25, 50, 100] as $n)
                <option value="{{ $n }}" @selected(per_page() === $n)>{{ $n }}</option>
            @endforeach
        </select>
    </form>
    <div>{{ $paginator->links() }}</div>
</div>
@endif
