mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Fix pagination() to get the right total number of pages
This commit is contained in:
		@@ -5,6 +5,7 @@
 | 
				
			|||||||
package admin
 | 
					package admin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"math"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/Unknwon/com"
 | 
						"github.com/Unknwon/com"
 | 
				
			||||||
@@ -30,7 +31,7 @@ func pagination(ctx *middleware.Context, count int64, pageNum int) int {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	curCount := int64((p-1)*pageNum + pageNum)
 | 
						curCount := int64((p-1)*pageNum + pageNum)
 | 
				
			||||||
	if curCount >= count {
 | 
						if curCount >= count {
 | 
				
			||||||
		p = int(count) / pageNum
 | 
							p = int(math.Ceil(float64(count) / float64(pageNum)))
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		ctx.Data["NextPageNum"] = p + 1
 | 
							ctx.Data["NextPageNum"] = p + 1
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user