You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.go 465B

12345678910111213141516171819
  1. // Copyright 2016 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package convert
  5. import (
  6. "code.gitea.io/gitea/modules/setting"
  7. )
  8. // ToCorrectPageSize makes sure page size is in allowed range.
  9. func ToCorrectPageSize(size int) int {
  10. if size <= 0 {
  11. size = 10
  12. } else if size > setting.API.MaxResponseItems {
  13. size = setting.API.MaxResponseItems
  14. }
  15. return size
  16. }