Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.216.2.16 -r1.216.2.17 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 7 Feb 2022 15:49:52 -0000 1.216.2.16 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 30 Aug 2022 08:24:05 -0000 1.216.2.17 @@ -790,10 +790,11 @@ db_foreach revert_target_pages {} { if { ! [db_0or1row revert_get_source_page_id {}] } { set move_to_page_id [db_string revert_min_page_id_select { - select min(page_id) + select page_id from portal_pages where portal_id = :portal_id - order by sort_key + order by sort_key asc, page_id asc + fetch first 1 rows only }] db_foreach revert_move_elements_for_del {} {