diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt index 3b7247c3e12..07104445e8c 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt @@ -19,7 +19,7 @@ fun Pagination.reverse(datasetSize: Long): SimplePagination { newPage, size ).let { - if (it.lastIndex > datasetSize) { + if (it.lastIndex >= datasetSize) { it.copy(size = (datasetSize - firstIndex - 1).toInt()) } else { it