            return groupA.localeCompare(groupB) || a.title.localeCompare(b.title);
                        });
                        break;
                    case 'random':
                        shuffleArray(filteredDatasets);
                        break;
                }
            }

            function displayCurrentPage() {
                const startIndex = (currentPage - 1) * itemsPerPage;
                const endIndex = startIndex + itemsPerPage;
                const currentPageItems = f