code: func maxIndex(start, limit, total int) (max int) {
  	if limit <= 0 {
  		limit = mock.DefaultLimit
  	}
  	if limit > mock.MaxLimit {
  		limit = mock.MaxLimit
  	}
  	max = total
  	if start+limit < max {
  		max = start + limit
  	}
  	return max
  }
docs: // maxIndex returns the end index for one page listing
  // based on the start index, limit and total number of elements.