diff --git a/components/ui/Pagination.vue b/components/ui/Pagination.vue index 77671cdbb7..389977c2a5 100644 --- a/components/ui/Pagination.vue +++ b/components/ui/Pagination.vue @@ -82,7 +82,7 @@ export default { pages() { let pages = [] - if (this.count > 4) { + if (this.count > 7) { if (this.page + 3 >= this.count) { pages = [ 1, @@ -93,7 +93,7 @@ export default { this.count - 1, this.count, ] - } else if (this.page > 4) { + } else if (this.page > 5) { pages = [1, '-', this.page - 1, this.page, this.page + 1, '-', this.count] } else { pages = [1, 2, 3, 4, 5, '-', this.count] @@ -108,6 +108,9 @@ export default { methods: { switchPage(newPage) { this.$emit('switch-page', newPage) + if (newPage !== null && newPage !== '' && !isNaN(newPage)) { + this.$emit('switch-page', Math.min(Math.max(newPage, 1), this.count)) + } }, }, } diff --git a/pages/[type]/[id]/changelog.vue b/pages/[type]/[id]/changelog.vue index 20227b9516..340ddd1fcd 100644 --- a/pages/[type]/[id]/changelog.vue +++ b/pages/[type]/[id]/changelog.vue @@ -111,7 +111,6 @@ const filteredVersions = computed(() => { const selectedLoaders = getArrayOrString(route.query.l) ?? [] const selectedVersionTypes = getArrayOrString(route.query.c) ?? [] - currentPage.value = 1 return props.versions.filter( (projectVersion) => (selectedGameVersions.length === 0 || diff --git a/pages/[type]/[id]/versions.vue b/pages/[type]/[id]/versions.vue index 8357b99ad2..7435a6509d 100644 --- a/pages/[type]/[id]/versions.vue +++ b/pages/[type]/[id]/versions.vue @@ -158,7 +158,6 @@ const filteredVersions = computed(() => { const selectedLoaders = getArrayOrString(route.query.l) ?? [] const selectedVersionTypes = getArrayOrString(route.query.c) ?? [] - currentPage.value = 1 return props.versions.filter( (projectVersion) => (selectedGameVersions.length === 0 ||