<commit_before>from pprint import pprint

from django.http import Http404

from stream.models import YouTube
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.shortcuts import render, redirect
from .models import GamesServersList, LinkBlog
from django.shortcuts import get_object_or_404
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from .meta import meta_generator


def index(request):
    yt = YouTube.objects.filter(accepted=True).order_by('-id')[:2]
    ptr = LinkBlog.objects.filter(accepted=True).order_by('-id')[:4]
    return render(request, 'service/index.html', {
        'youtube': yt,
        'ptr': ptr,
        'meta': meta_generator()
    })


def livestreams(request):
    meta = {
        'title': 'LiveStream',
        'description': 'Poznaj najlepsze streamy dostępne na platformie Twitch! Tylko od polskich twórców!',
    }
    return render(request, 'player/livestream.html', {
        'meta': meta_generator(meta)
    })


def youtube(request, page=1):
    meta = {
        'title': 'Filmy na YouTube',
        'description': 'Najciekawsze filmy dostępne na YouTube! Zapomnij o "Na czasie" - teraz masz JestemGraczem.pl',
    }

    yt = YouTube.objects.filter(accepted=True).order_by('-id')
    paginator = Paginator(yt, 1)
    youtube_list = paginator.get_page(page)

    return render(request, 'player/youtube.html', {
        'youtube': youtube_list,
        'meta': meta_generator(meta)
    })


def youtube_player(request, videoid):
    yt = get_object_or_404(YouTube, video_id=videoid)
    meta = {
        'title': yt.name,
    }
    return render(request, 'player/youtube_video.html', {
        'youtube': yt,
        'meta': meta_generator(meta)
    })


def gameservers(request):
    official_servers = GamesServersList.objects.filter(official=True)
    servers = GamesServersList.objects.filter(official=False)<commit_msg>Fix: Pagination<commit_after>from pprint import pprint

from django.http import Http404

from stream.models import YouTube
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.shortcuts import render, redirect
from .models import GamesServersList, LinkBlog
from django.shortcuts import get_object_or_404
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from .meta import meta_generator


def index(request):
    yt = YouTube.objects.filter(accepted=True).order_by('-id')[:2]
    ptr = LinkBlog.objects.filter(accepted=True).order_by('-id')[:4]
    return render(request, 'service/index.html', {
        'youtube': yt,
        'ptr': ptr,
        'meta': meta_generator()
    })


def livestreams(request):
    meta = {
        'title': 'LiveStream',
        'description': 'Poznaj najlepsze streamy dostępne na platformie Twitch! Tylko od polskich twórców!',
    }
    return render(request, 'player/livestream.html', {
        'meta': meta_generator(meta)
    })


def youtube(request, page=1):
    meta = {
        'title': 'Filmy na YouTube',
        'description': 'Najciekawsze filmy dostępne na YouTube! Zapomnij o "Na czasie" - teraz masz JestemGraczem.pl',
    }

    yt = YouTube.objects.filter(accepted=True).order_by('-id')
    paginator = Paginator(yt, 6)
    youtube_list = paginator.get_page(page)

    return render(request, 'player/youtube.html', {
        'youtube': youtube_list,
        'meta': meta_generator(meta)
    })


def youtube_player(request, videoid):
    yt = get_object_or_404(YouTube, video_id=videoid)
    meta = {
        'title': yt.name,
    }
    return render(request, 'player/youtube_video.html', {
        'youtube': yt,
        'meta': meta_generator(meta)
    })


def gameservers(request):
    official_servers = GamesServersList.objects.filter(official=True)
    servers = GamesServersList.objects.filter(official=False)
{'fraction_non_alphanumeric': 0.11397058823529412, 'fraction_numerical': 0.006372549019607843, 'mean_word_length': 3.846793349168646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2832520', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1290, 'n_words': 290}