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.

19 lines
471 B

  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. "github.com/go-gitea/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. }