<commit_before>from django.views.generic import View
from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator

from items.models import ItemPost


class PostList(View):

    def get(self, request):

        page = request.GET.get("page", 1)
        page_per = request.GET.get("per", 1)

        paginator = Paginator(
                # 가장 나중에 만들어진 포스트를 먼저 꺼내기 위해 '-id'사용
                ItemPost.objects.order_by('-id'),
                page_per,
                )

        posts = paginator.page(page)

        # 페이지 리스트 커스터마이징
        page_list = []
        for page_number in posts.paginator.page_range:
            if page_number == 1 or (page_number-2) <= posts.number <= (page_number+2) \
                    or page_number == posts.paginator.count:
                page_list.append(page_number)
                print(page_list)
            else:
                if page_list[-1] == '...':
                    print(page_list)
                    continue
                else:
                    page_list.append('...')
                    print(page_list)<commit_msg>update : 5 Posts will expose per page<commit_after>from django.views.generic import View
from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator

from items.models import ItemPost


class PostList(View):

    def get(self, request):

        page = request.GET.get("page", 1)
        page_per = request.GET.get("per", 5)

        paginator = Paginator(
                # 가장 나중에 만들어진 포스트를 먼저 꺼내기 위해 '-id'사용
                ItemPost.objects.order_by('-id'),
                page_per,
                )

        posts = paginator.page(page)

        # 페이지 리스트 커스터마이징
        page_list = []
        for page_number in posts.paginator.page_range:
            if page_number == 1 or (page_number-2) <= posts.number <= (page_number+2) \
                    or page_number == posts.paginator.count:
                page_list.append(page_number)
                print(page_list)
            else:
                if page_list[-1] == '...':
                    print(page_list)
                    continue
                else:
                    page_list.append('...')
                    print(page_list)
{'fraction_non_alphanumeric': 0.09538066723695467, 'fraction_numerical': 0.005560307955517536, 'mean_word_length': 1.6221973094170403, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2856702', 'n_tokens_mistral': 746, 'n_tokens_neox': 736, 'n_words': 151}