Clamp negative pos parameters to 0 in getTableListPosition(); a
negative value used to be stored in the session and end up as a
negative array_slice() offset or an invalid negative SQL OFFSET.
Redirect to the last page when the position is exactly equal to the
total number of tables: such a page is empty, but the previous check
only redirected when the position was strictly greater, rendering an
empty table list for a non-empty database.
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add unit tests for the previously untested paths of getDbInfo(): sort
name mapping (including descending order and unknown sort columns),
the tbl_group and tbl_type filters, and MaxTableList paging.
Refactor getDbInfo() into three flat branches, replacing the
string|false $groupWithSeparator juggling and the duplicated string
checks. The sort name is now mapped with a match expression. The paging
position is passed as an explicit parameter instead of being read from
a private field, and the total table count is always returned as an int
instead of int|null, so the caller no longer needs a fallback count.
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>