Привет! сделай чтобы в пагинации, кнопок было ограниченное количество, максимум по две кнопки с каждой стороны текущей страницы(current) - function generatePagination(data) {
                var paginationLinks = $('#pagination-links');
                paginationLinks.empty();

                var prevLink = $('<li><a class="flex items-center justify-center px-3 h-8 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="w-2.5 h-2.5 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 1 1 5l4 4"/></svg></a></li>');
                prevLink.find('a').on('click', function(e) {
                    e.preventDefault();
                    if (data.has_prev) {
                        loadArticles(data.current_page - 1, query, $('#new-checkbox').is(':checked'));
                    }
                });

                if (!data.has_prev) {
                    prevLink.addClass('disabled');
                }
                paginationLinks.append(prevLink);

                for (var i = 1; i <= data.total_pages; i++) {
                    if (i === data.current_page) {
                        var link = $('<li><span style="cursor: default;" aria-current="page" class="z-10 flex items-center justify-center px-3 h-8 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white" data-page="' + i + '">' + i + '</span></li>');
                        paginationLinks.append(link);
                    }

                    else {
                        var link = $('<li><a style="cursor: pointer;" class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white" data-page="' + i + '">' + i + '</a></li>');
                        link.find('a').on('click', function(e) {
                            e.preventDefault();
                            var pageNumber = parseInt($(this).data('page'), 10);
                            loadArticles(pageNumber, query, $('#new-checkbox').is(':checked'));
                        });
                        paginationLinks.append(link);
                    }
                }

                var nextLink = $('<li><a class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="w-2.5 h-2.5 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/></svg></a></li>');
                nextLink.find('a').on('click', function(e) {
                    e.preventDefault();
                    if (data.has_next) {
                        loadArticles(data.current_page + 1, query, $('#new-checkbox').is(':checked'));
                    }
                });

                if (!data.has_next) {
                    nextLink.addClass('disabled');
                }

                paginationLinks.append(nextLink);

                $('html, body').animate({
                    scrollTop: 0
                }, 'slow');
            }
            
            if (data.articles.length > 0) {
                generatePagination(data);
            }