1
0
mirror of https://github.com/writeas/writefreely synced 2025-01-31 18:24:52 +01:00

Fix admin user paging query

This commit is contained in:
Matt Baer 2019-01-05 08:47:42 -05:00
parent 0e722de82c
commit 3d301c97e9

View File

@ -2223,7 +2223,7 @@ func (db *datastore) GetAllUsers(page uint) (*[]User, error) {
const usersPerPage = 30
limitStr := fmt.Sprintf("0, %d", usersPerPage)
if page > 1 {
limitStr = fmt.Sprintf("%d, %d", page*usersPerPage, page*usersPerPage+usersPerPage)
limitStr = fmt.Sprintf("%d, %d", (page-1)*usersPerPage, usersPerPage)
}
rows, err := db.Query("SELECT id, username, created FROM users ORDER BY created DESC LIMIT " + limitStr)