Koha-clms/Koha
Tomas Cohen Arazi 25724e8f3e Bug 35129: Return 400 if _per_page=0 passed
This patch adds a safe guard for when consumers pass _per_page=0 to
endpoints. This condition is checked for on a centralized place and
avoid reaching the controller in such scenarios that would provoke a
division by zero exception.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/pagination.t
=> FAIL: We expect a 400, but get a 500 instead
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! No more explosions for this!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 308bb0830c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b1e9ef93f2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-05-28 16:47:54 +00:00
..
Account
…
Acquisition
…
App
…
ArticleRequest
…
Auth
…
Authority
…
BackgroundJob Bug 35843: Correct invalid exception 2024-02-08 18:51:19 +00:00
Biblio
…
BiblioUtils
…
Cache
…
Cash
…
Charges
…
Checkouts
…
Club
…
CodeList/Unimarc
…
Config
…
Course
…
Database
…
DateTime/Format Bug 36432: Remove circular dependency from Koha::Object 2024-05-28 16:36:58 +00:00
ERM
…
Edifact
…
Exceptions
…
Exporter
…
ExternalContent
…
Filter/MARC
…
Hold
…
Illrequest
…
Import
…
Indexer
…
Item
…
Library
…
List
…
MetadataRecord
…
Middleware Bug 36149: (follow-up) POD and tidy 2024-05-01 15:35:19 +00:00
Misc
…
Notice Bug 30287: (follow-up) Add content wrap matching send time 2024-01-04 20:34:51 +00:00
Number
…
OAI/Server
…
Object
…
Objects
…
Old
…
Patron
…
Patrons
…
Plugins
…
REST Bug 35129: Return 400 if _per_page=0 passed 2024-05-28 16:47:54 +00:00
RecordProcessor
…
Result
…
SMS
…
SMTP
…
Schema Bug 31297: DBIC 2024-01-12 20:38:37 +00:00
SearchEngine Bug 35086: Add chunk_size option to elasticsearch configuration 2024-02-02 16:25:22 +00:00
Serial
…
Sitemapper
…
Subscription
…
SuggestionEngine
…
Tags
…
Template/Plugin Bug 35955: Cache CSRF token in template plugin 2024-03-19 21:23:36 +00:00
Ticket
…
UI
…
Util
…
XSLT
…
Z3950Responder
…
pdfformat
…
Account.pm
…
ActionLog.pm
…
ActionLogs.pm
…
AdditionalContent.pm
…
AdditionalContents.pm
…
AdditionalField.pm
…
AdditionalFieldValue.pm
…
AdditionalFieldValues.pm
…
AdditionalFields.pm
…
AdvancedEditorMacro.pm
…
AdvancedEditorMacros.pm
…
ApiKey.pm
…
ApiKeys.pm
…
ArticleRequest.pm
…
ArticleRequests.pm
…
AudioAlert.pm
…
AudioAlerts.pm
…
AuthUtils.pm
…
AuthorisedValue.pm
…
AuthorisedValueCategories.pm
…
AuthorisedValueCategory.pm
…
AuthorisedValues.pm Bug 35579: Cache authorised value lookup by MARC field 2024-01-12 22:02:27 +00:00
Authorities.pm
…
Authority.pm
…
BackgroundJob.pm Bug 35843: Correct invalid exception 2024-02-08 18:51:19 +00:00
BackgroundJobs.pm
…
Biblio.pm
…
BiblioFramework.pm
…
BiblioFrameworks.pm
…
BiblioUtils.pm
…
Biblioitem.pm
…
Biblioitems.pm
…
Biblios.pm
…
Cache.pm
…
Caches.pm
…
Calendar.pm
…
Checkout.pm
…
Checkouts.pm
…
CirculationRule.pm
…
CirculationRules.pm
…
Cities.pm
…
City.pm
…
ClassSortRule.pm
…
ClassSortRules.pm
…
ClassSource.pm
…
ClassSources.pm
…
ClassSplitRule.pm
…
ClassSplitRules.pm
…
Club.pm
…
Clubs.pm
…
Config.pm
…
CookieManager.pm
…
Course.pm
…
Courses.pm
…
CoverImage.pm
…
CoverImages.pm
…
CsvProfile.pm
…
CsvProfiles.pm
…
CurbsidePickup.pm
…
CurbsidePickupIssue.pm
…
CurbsidePickupIssues.pm
…
CurbsidePickupOpeningSlot.pm
…
CurbsidePickupOpeningSlots.pm
…
CurbsidePickupPolicies.pm
…
CurbsidePickupPolicy.pm
…
CurbsidePickups.pm
…
Database.pm
…
DateUtils.pm Bug 36432: Remove circular dependency from Koha::Object 2024-05-28 16:36:58 +00:00
Desk.pm
…
Desks.pm
…
EDI.pm Bug 35398: (QA follow-up) Tidy code 2024-03-19 15:21:43 +00:00
Edifact.pm
…
Email.pm
…
Encryption.pm
…
Exception.pm
…
Exceptions.pm
…
ExternalContent.pm
…
FrameworkPlugin.pm
…
Hold.pm
…
Holds.pm
…
I18N.pm Bug 35174: Do not explode if po dir does not exist 2023-11-22 09:33:46 +01:00
Illbackend.pm
…
Illcomment.pm
…
Illcomments.pm
…
Illrequest.pm
…
Illrequestattribute.pm
…
Illrequestattributes.pm
…
Illrequests.pm
…
ImportBatch.pm
…
ImportBatchProfile.pm
…
ImportBatchProfiles.pm
…
ImportBatches.pm
…
Item.pm
…
ItemType.pm
…
ItemTypes.pm
…
Items.pm
…
KeyboardShortcut.pm
…
KeyboardShortcuts.pm
…
Libraries.pm
…
Library.pm
…
Linktracker.pm
…
Localization.pm
…
Localizations.pm
…
Logger.pm
…
Manual.pm
…
MarcOverlayRule.pm
…
MarcOverlayRules.pm
…
MarcSubfieldStructure.pm
…
MarcSubfieldStructures.pm
…
MessageAttribute.pm
…
MessageAttributes.pm
…
MetaSearcher.pm
…
MetadataIterator.pm
…
MetadataRecord.pm
…
MoreUtils.pm
…
OAuth.pm
…
OAuthAccessToken.pm
…
OAuthAccessTokens.pm
…
Object.pm Bug 36432: Remove circular dependency from Koha::Object 2024-05-28 16:36:58 +00:00
Objects.pm
…
Patron.pm Bug 19613: Use the 'note' profile 2024-05-01 15:33:51 +00:00
Patrons.pm Bug 36508: Refresh patron object when updating category 2024-05-23 14:08:27 +00:00
Plugins.pm Bug 35507: Add verbose parameters in Koha::Plugins 2024-02-14 16:29:01 +00:00
ProblemReport.pm
…
ProblemReports.pm
…
PseudonymizedTransaction.pm
…
PseudonymizedTransactions.pm
…
Quote.pm
…
Quotes.pm
…
RDF.pm
…
Rating.pm
…
Ratings.pm
…
Recall.pm
…
Recalls.pm
…
RecordProcessor.pm
…
Report.pm
…
Reports.pm
…
Review.pm
…
Reviews.pm
…
Schema.pm
…
Script.pm
…
SearchEngine.pm
…
SearchField.pm
…
SearchFields.pm
…
SearchFilter.pm
…
SearchFilters.pm
…
SearchMarcMap.pm
…
SearchMarcMaps.pm
…
Serial.pm
…
Serials.pm
…
Session.pm Bug 36098: Default to 'file' if pref does not exist 2024-03-19 15:03:55 +00:00
SharedContent.pm
…
SimpleMARC.pm
…
Sitemapper.pm
…
Statistic.pm
…
Statistics.pm
…
StockRotationItem.pm
…
StockRotationItems.pm
…
StockRotationRota.pm
…
StockRotationRotas.pm
…
StockRotationStage.pm
…
StockRotationStages.pm
…
Subscription.pm
…
Subscriptions.pm
…
Suggestion.pm
…
SuggestionEngine.pm
…
Suggestions.pm
…
Tag.pm
…
Tags.pm
…
Ticket.pm Bug 36612: (QA follow-up) Add 'source' to public_read_list 2024-05-23 14:23:41 +00:00
Tickets.pm
…
Token.pm Bug 34755: Backport Koha::Token change from bug 34478 2024-03-19 21:26:05 +00:00
TrackedLink.pm
…
TrackedLinks.pm
…
UploadedFile.pm
…
UploadedFiles.pm
…
Uploader.pm
…
Virtualshelf.pm
…
Virtualshelfcontent.pm
…
Virtualshelfcontents.pm
…
Virtualshelfshare.pm
…
Virtualshelfshares.pm
…
Virtualshelves.pm
…
Z3950Responder.pm
…
Z3950Server.pm
…
Z3950Servers.pm
…