From 3496c5aece17ef57437fb6d1336830db3dfd8b1a Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 18 Nov 2014 11:08:14 +1100 Subject: [PATCH] Fix merge issue --- .../Persistence/Repositories/ContentRepository.cs | 4 ---- .../Persistence/Repositories/VersionableRepositoryBase.cs | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index 08fa542d67..d89fc79dbe 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -728,10 +728,6 @@ namespace Umbraco.Core.Persistence.Repositories Func> filterCallback = () => new Tuple(sbWhere.ToString(), args.ToArray()); - // that doesn't actually have any data on it, the totalRecords will still indicate there are records but there are none in - // the pageResult, then the GetAll will actually return ALL records in the db. - if (pagedResult.Items.Any()) - return GetPagedResultsByQuery(query, pageIndex, pageSize, out totalRecords, new Tuple("cmsDocument", "nodeId"), ProcessQuery, orderBy, orderDirection, diff --git a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs index 7fa6fef92f..3acc06b132 100644 --- a/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/VersionableRepositoryBase.cs @@ -308,7 +308,11 @@ namespace Umbraco.Core.Persistence.Repositories IEnumerable result; var pagedResult = Database.Page(pageIndex + 1, pageSize, sqlNodeIdsWithSort); totalRecords = Convert.ToInt32(pagedResult.TotalItems); - if (totalRecords > 0) + + //NOTE: We need to check the actual items returned, not the 'totalRecords', that is because if you request a page number + // that doesn't actually have any data on it, the totalRecords will still indicate there are records but there are none in + // the pageResult, then the GetAll will actually return ALL records in the db. + if (pagedResult.Items.Any()) { //Crete the inner paged query that was used above to get the paged result, we'll use that as the inner sub query var args = sqlNodeIdsWithSort.Arguments;