From 5f8d75d7fa33a19709fd390f47b8fc536cc3e743 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Sat, 6 Oct 2018 19:15:19 +0200
Subject: [PATCH] FEAT improve pagination list v1 + css

---
 .../contact_addresses_list.php                | 19 ++--
 .../contact_purposes/contact_purposes.php     | 10 +-
 .../contacts/contact_types/contact_types.php  | 10 +-
 .../contacts/contacts_v2/contacts_v2.php      | 12 ++-
 .../contacts/contacts_v2/contacts_v2_up.php   | 10 +-
 .../class/class_list_show_Abstract.php        | 28 +++---
 ...class_list_show_with_template_Abstract.php | 12 +--
 .../class/class_lists_Abstract.php            | 45 +++++----
 apps/maarch_entreprise/css/styles.css         |  2 +-
 .../documents_list_copies.php                 |  5 +-
 .../documents_list_with_attachments.php       | 12 ++-
 apps/maarch_entreprise/index.php              |  4 +-
 .../documents_list_mlb_search_adv.php         | 13 ++-
 .../indexing_searching/list_results_mlb.php   |  2 +-
 apps/maarch_entreprise/js/functions.js        |  9 +-
 apps/maarch_entreprise/lang/en.php            |  3 +
 apps/maarch_entreprise/lang/fr.php            |  3 +
 .../my_contacts/my_contacts.php               | 12 ++-
 core/class/class_db_pdo.php                   |  3 +-
 core/class/class_request.php                  | 10 +-
 .../attachments/frame_list_attachments.php    | 13 ++-
 .../avis/difflist_avis_history_display.php    | 11 +--
 modules/avis/documents_list_with_avis.php     | 14 ++-
 modules/basket/cleanSessionBasket.php         |  2 +-
 modules/basket/view_baskets.php               |  3 +-
 modules/cases/cases_documents_list.php        | 91 ++++---------------
 modules/cases/cases_list_search_adv.php       | 72 ++++++---------
 modules/cases/cases_notes_list.php            | 11 ++-
 modules/cases/list_results_mlb_frame.php      |  6 +-
 modules/entities/difflist_display.php         |  4 +-
 modules/entities/difflist_history_display.php |  8 +-
 .../difflist_visa_history_display.php         | 11 +--
 modules/entities/js/functions.js              | 25 ++---
 modules/entities/put_in_copy.php              |  2 +-
 modules/fileplan/fileplan_managment.php       | 11 +--
 modules/fileplan/positions_documents_list.php | 13 +--
 modules/folder/folders_list_search_adv.php    | 17 +++-
 modules/folder/foldertypes.php                | 12 ++-
 modules/folder/search_adv_folder_result.php   |  2 +-
 modules/notes/notes.php                       | 16 +++-
 modules/sendmail/sendmail.php                 |  9 +-
 modules/tags/manage_tag_list.php              |  2 +-
 modules/tags/manage_tag_list_controller.php   | 11 ++-
 modules/thesaurus/manage_thesaurus_list.php   |  2 +-
 .../manage_thesaurus_list_controller.php      | 15 ++-
 .../visa/documents_list_with_signatory.php    |  9 +-
 46 files changed, 313 insertions(+), 303 deletions(-)

diff --git a/apps/maarch_entreprise/admin/contacts/contact_addresses/contact_addresses_list.php b/apps/maarch_entreprise/admin/contacts/contact_addresses/contact_addresses_list.php
index a07988a9d36..aae950d2e29 100755
--- a/apps/maarch_entreprise/admin/contacts/contact_addresses/contact_addresses_list.php
+++ b/apps/maarch_entreprise/admin/contacts/contact_addresses/contact_addresses_list.php
@@ -63,10 +63,10 @@ $core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $leve
 $select['view_contacts'] = array();
 array_push(
     $select['view_contacts'],
-    'ca_id', "contact_id
-    , case when view_contacts.is_corporate_person <> 'Y' then view_contacts.contact_id || ' - ' || view_contacts.contact_lastname || ' ' || view_contacts.contact_firstname|| ' - physique' else view_contacts.contact_id || ' - ' || view_contacts.society || ' - moral' end as \"society\"", 'contact_purpose_id', "departement
-    , case when view_contacts.contact_lastname <> '' then view_contacts.contact_lastname else view_contacts.lastname end as \"lastname\"
-    , case when view_contacts.contact_firstname <> '' then view_contacts.contact_firstname else view_contacts.firstname end as \"firstname\"
+    'ca_id', "contact_id
+    , case when view_contacts.is_corporate_person <> 'Y' then view_contacts.contact_id || ' - ' || view_contacts.contact_lastname || ' ' || view_contacts.contact_firstname|| ' - physique' else view_contacts.contact_id || ' - ' || view_contacts.society || ' - moral' end as \"society\"", 'contact_purpose_id', "departement
+    , case when view_contacts.contact_lastname <> '' then view_contacts.contact_lastname else view_contacts.lastname end as \"lastname\"
+    , case when view_contacts.contact_firstname <> '' then view_contacts.contact_firstname else view_contacts.firstname end as \"firstname\"
     , case when view_contacts.contact_function <> '' then view_contacts.contact_function else view_contacts.function end as \"function\"", 'address_town', 'phone', 'email'
 );
 $what = '';
@@ -121,9 +121,14 @@ array_pop($select['view_contacts']);
 
 $orderstr = $list->define_order($order, $field);
 
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
 $request = new request();
 $tab = $request->PDOselect(
-    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']
+    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, false, $_REQUEST['start']
 );
 // $request->show();
 
@@ -270,10 +275,10 @@ $autoCompletionArray['list_script_url'] = $_SESSION['config']['businessappurl']
 $autoCompletionArray['number_to_begin'] = 1;
 $autoCompletionArray['searchBoxAutoCompletionUpdate'] = true;
 
-$title = _ADDRESSES_LIST.' : '.$i.' '._ADDRESSES;
+$title = _ADDRESSES_LIST.' : '.$_SESSION['save_list']['full_count'].' '._ADDRESSES;
 
 $list->admin_list(
-    $tab, $i, $title,
+    $tab, $_SESSION['save_list']['full_count'], $title,
     'contact_id', 'contact_addresses_list', 'contact_addresses',
     'id', true, $pageNameUp, $pageNameVal, $pageNameBan,
     $pageNameDel, $pageNameAdd, $addLabel, false, false, _ALL_CONTACT_ADDRESSES,
diff --git a/apps/maarch_entreprise/admin/contacts/contact_purposes/contact_purposes.php b/apps/maarch_entreprise/admin/contacts/contact_purposes/contact_purposes.php
index 9b39bbf8967..de87b92e019 100755
--- a/apps/maarch_entreprise/admin/contacts/contact_purposes/contact_purposes.php
+++ b/apps/maarch_entreprise/admin/contacts/contact_purposes/contact_purposes.php
@@ -81,9 +81,15 @@ if (isset($_REQUEST['order_field']) && ! empty($_REQUEST['order_field'])) {
 
 $orderstr = $list->define_order($order, $field);
 
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
+
 $request = new request;
 $tab = $request->PDOselect(
-    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']
+    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, false, $_REQUEST['start']
 );
 for ($i = 0; $i < count($tab); $i ++) {
     for ($j = 0; $j < count($tab[$i]); $j ++) {
@@ -128,7 +134,7 @@ $autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']
     . "index.php?display=true&page=contact_purposes_list_by_name";
 $autoCompletionArray["number_to_begin"] = 1;
 $list->admin_list(
-    $tab, $i, _CONTACT_PURPOSES_LIST . ' : ' . $i . " " . _CONTACT_PURPOSES,
+    $tab, $_SESSION['save_list']['full_count'], _CONTACT_PURPOSES_LIST . ' : ' .$_SESSION['save_list']['full_count']. " " . _CONTACT_PURPOSES,
     'contact_purposes_id"', 'contact_purposes', 'contact_purposes',
     'contact_purposes_id', true, $pageNameUp, $pageNameVal, $pageNameBan,
     $pageNameDel, $pageNameAdd, $addLabel, FALSE, FALSE, _ALL_CONTACT_PURPOSES,
diff --git a/apps/maarch_entreprise/admin/contacts/contact_types/contact_types.php b/apps/maarch_entreprise/admin/contacts/contact_types/contact_types.php
index 07129a789d3..af21b4d1bd1 100755
--- a/apps/maarch_entreprise/admin/contacts/contact_types/contact_types.php
+++ b/apps/maarch_entreprise/admin/contacts/contact_types/contact_types.php
@@ -82,9 +82,15 @@ if (isset($_REQUEST['order_field']) && ! empty($_REQUEST['order_field'])) {
 
 $orderstr = $list->define_order($order, $field);
 
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
+
 $request = new request;
 $tab = $request->PDOselect(
-    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']
+    $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, false, $_REQUEST['start']
 );
 for ($i = 0; $i < count($tab); $i ++) {
     for ($j = 0; $j < count($tab[$i]); $j ++) {
@@ -148,7 +154,7 @@ $autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']
     . "index.php?display=true&page=contact_types_list_by_name";
 $autoCompletionArray["number_to_begin"] = 1;
 $list->admin_list(
-    $tab, $i, _CONTACT_TYPES_LIST . ' : ' . $i . " " . _CONTACT_TYPES,
+    $tab, $_SESSION['save_list']['full_count'], _CONTACT_TYPES_LIST . ' : ' . $_SESSION['save_list']['full_count'] . " " . _CONTACT_TYPES,
     'contact_types_id"', 'contact_types', 'contact_types',
     'contact_types_id', true, $pageNameUp, $pageNameVal, $pageNameBan,
     $pageNameDel, $pageNameAdd, $addLabel, FALSE, FALSE, _ALL_CONTACT_TYPES,
diff --git a/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2.php b/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2.php
index 2fe253512ad..feb7183c692 100755
--- a/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2.php
+++ b/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2.php
@@ -130,7 +130,11 @@ if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field']))
 }
 
 $orderstr = $list->define_order($order, $field);
-
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
 //EXPORT DE LA LISTE
 $select2[$_SESSION['tablename']['contacts_v2']] = array();
 array_push($select2[$_SESSION['tablename']['contacts_v2']], 'contact_id as "'._ID.'"','is_corporate_person as "'._IS_CORPORATE_PERSON.'"', 'contact_type as "'._CONTACT_TYPE.'"','lastname as "'._LASTNAME . '"', 'firstname as "'._FIRSTNAME . '"', 'society as "'._STRUCTURE_ORGANISM . '"');
@@ -145,7 +149,7 @@ $_SESSION['export_admin_list']['where'] = $where;
 $_SESSION['export_admin_list']['aPDO'] = $arrayPDO;
 $_SESSION['export_admin_list']['order'] = $orderstr;
 
-$tab=$request->PDOselect($select,$where,$arrayPDO, $orderstr,$_SESSION['config']['databasetype']);
+$tab=$request->PDOselect($select,$where,$arrayPDO, $orderstr,$_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, false, $_REQUEST['start']);
 
 for ($i=0;$i<count($tab);$i++)
 {
@@ -261,13 +265,13 @@ if ($admin->test_admin('admin_contacts', 'apps', false)) {
 $page_name_add = "contacts_v2_add";
 $label_add = _CONTACT_ADDITION;
 $_SESSION['m_admin']['init'] = true;
-$title = _CONTACTS_LIST." : ".$i." "._CONTACTS;
+$title = _CONTACTS_LIST." : ".$_SESSION['save_list']['full_count']." "._CONTACTS;
 $autoCompletionArray = array();
 $autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."index.php?display=true&page=contacts_v2_list_by_name";
 $autoCompletionArray["number_to_begin"] = 1;
 $autoCompletionArray["searchBoxAutoCompletionUpdate"] = true;
 
-$list->admin_list($tab, $i, $title, 'contact_id','contacts_v2','contacts_v2','contact_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, FALSE, _ALL_CONTACTS, _CONTACT, 'users', false, true, true, true, $what, true, $autoCompletionArray, false, true);
+$list->admin_list($tab, $_SESSION['save_list']['full_count'], $title, 'contact_id','contacts_v2','contacts_v2','contact_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, FALSE, FALSE, _ALL_CONTACTS, _CONTACT, 'users', false, true, true, true, $what, true, $autoCompletionArray, false, true);
 $_SESSION['m_admin']['contacts'] = array();
 $_SESSION['m_admin']['contacts']['id'] = "";
 $_SESSION['m_admin']['contacts']['title'] = "";
diff --git a/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2_up.php b/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2_up.php
index 6bb37e458a4..290d4a26cac 100755
--- a/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2_up.php
+++ b/apps/maarch_entreprise/admin/contacts/contacts_v2/contacts_v2_up.php
@@ -128,13 +128,19 @@ if (isset($_REQUEST['order_field']) && ! empty($_REQUEST['order_field']) && in_a
 
 $orderstr = $list->define_order($order, $field);
 
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
+
 $request = new request;
 $tab = $request->PDOselect(
     $select,
     $where,
     $arrayPDO,
     $orderstr,
-    $_SESSION['config']['databasetype']
+    $_SESSION['config']['databasetype'], "default", false, "", "", "", true, false, true, $_REQUEST['start']
 );
 for ($i = 0; $i < count($tab); $i ++) {
     for ($j = 0; $j < count($tab[$i]); $j ++) {
@@ -334,7 +340,7 @@ if ($_SESSION['origin']=='contacts_list') {
 }
 
 $list->admin_list(
-    $tab, $i, '',
+    $tab, $_SESSION['save_list']['full_count'], '',
     'contact_id"', 'contacts_v2_up', 'contacts_v2',
     'id', true, $pageNameUp, $pageNameVal, $pageNameBan,
     $pageNameDel, $pageNameAdd, $addLabel, FALSE, FALSE, _ALL_CONTACT_ADDRESSES,
diff --git a/apps/maarch_entreprise/class/class_list_show_Abstract.php b/apps/maarch_entreprise/class/class_list_show_Abstract.php
index 19d3b692f0e..715eca10bcc 100755
--- a/apps/maarch_entreprise/class/class_list_show_Abstract.php
+++ b/apps/maarch_entreprise/class/class_list_show_Abstract.php
@@ -215,10 +215,7 @@ class list_show_Abstract extends functions
 
             $nb_show = $_SESSION['config']['nblinetoshow'];
             $nb_pages = ceil($nb_total / $nb_show);
-            $end = $start + $nb_show;
-            if ($end > $nb_total) {
-                $end = $nb_total;
-            }
+            $end = count($result);
 
             if ($actual_template != '') {
                 $link .= '&amp;template='.$actual_template;
@@ -409,7 +406,7 @@ class list_show_Abstract extends functions
             $str .= ' <tbody>';
             $color = '';
 
-            for ($theline = $start; $theline < $end; ++$theline) {
+            for ($theline = 0; $theline < $end; ++$theline) {
                 if ($color == ' class="col"') {
                     $color = '';
                 } else {
@@ -456,7 +453,6 @@ class list_show_Abstract extends functions
                     $str .= ' </div>';
                     $str .= ' </td>';
                 }
-
                 for ($count_column = 0; $count_column < count($listcolumn); ++$count_column) {
                     if (isset($result[$theline][$count_column]['show'])
                         && $result[$theline][$count_column]['show'] == true
@@ -758,11 +754,9 @@ class list_show_Abstract extends functions
 
         $func = new functions();
         $param_comp = '';
-        if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
-            $start = strip_tags($_REQUEST['start']);
-        } else {
-            $start = 0;
-        }
+  
+        $start = $_REQUEST['start'];
+      
         $param_comp .= '&amp;start='.$start;
         if ($name == 'structures' || $name == 'subfolders' || $name == 'types' || $name == 'contact_types' || $name == 'contact_purposes' || $name == 'contacts_v2' || $name == 'contacts_v2_up' || $name == 'contact_addresses_list') {
             $link = $_SESSION['config']['businessappurl'].'index.php?page='.$name;
@@ -801,12 +795,12 @@ class list_show_Abstract extends functions
         $param_comp .= '&amp;what='.$what;
         // define the defaults values
         $nb_show = $_SESSION['config']['nblinetoshow'];
+        $current_page = ceil($start / $nb_show)+1;
         $nb_pages = ceil($nb_total / $nb_show);
-        $end = $start + $nb_show;
-        if ($end > $nb_total) {
-            $end = $nb_total;
-        }
 
+        if ($nb_pages > 500) {
+            $nb_pages = 500;
+        }
         if (!empty($what)) {
             $link .= '&amp;what='.$what;
         }
@@ -827,7 +821,7 @@ class list_show_Abstract extends functions
                 $page_name = $i + 1;
 
                 $the_line = $i + 1;
-                if ($start == $next_start) {
+                if ($current_page == $the_line) {
                     $page_list1 .= '<option value="'.$next_start.'" selected="selected">'.$the_line.'</option>';
                     $page_list2 .= '<option value="'.$next_start.'"  selected="selected">'.$the_line.'</option>';
                 } else {
@@ -1001,7 +995,7 @@ class list_show_Abstract extends functions
         <tbody>
         <?php
         $color = '';
-        for ($theline = $start; $theline < $end; ++$theline) {
+        for ($theline = 0; $theline < count($result); ++$theline) {
             // background color
             if ($color == ' class="col"') {
                 $color = '';
diff --git a/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php b/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
index 161457c996e..783391ca2b5 100755
--- a/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
+++ b/apps/maarch_entreprise/class/class_list_show_with_template_Abstract.php
@@ -259,7 +259,7 @@ abstract class list_show_with_template_Abstract extends list_show
     public function tmplt_func_bool_detail_cases($actual_string, $theline, $result, $key)
     {
         if ($this->bool_detail == true) {
-            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?page=details_cases&module=cases&amp;id='.$result[$theline][0]['case_id']."' title='"._DETAILS_CASES."'>
+            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?page=details_cases&module=cases&amp;id='.$result[$theline][0]['case_id']."' title='"._DETAILS_CASES."'>
             <i class='fa fa-info-circle fa-2x' title='"._DETAILS."'></i></a>";
 
             return $return;
@@ -270,7 +270,7 @@ abstract class list_show_with_template_Abstract extends list_show
     public function tmplt_func_bool_view_doc($actual_string, $theline, $result, $key)
     {
         if ($this->bool_view_document == true) {
-            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$result[$theline][0][$key]."' target=\"_blank\" title='"._VIEW_DOC."'>
+            $return = "<a href='".$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$result[$theline][0][$key]."' target=\"_blank\" title='"._VIEW_DOC."'>
                        <i class='fa fa-download fa-2x' title='"._VIEW_DOC."'></i></a>";
 
             return $return;
@@ -643,10 +643,8 @@ abstract class list_show_with_template_Abstract extends list_show
         $this->the_link = $link;
         $nb_show = $_SESSION['config']['nblinetoshow'];
         $nb_pages = ceil($nb_total / $nb_show);
-        $end = $start + $nb_show;
-        if ($end > $nb_total) {
-            $end = $nb_total;
-        }
+        $end = count($result);
+
         if ($show_big_title) {
             $list_title .= '<h1>';
             if (!empty($picto_path)) {
@@ -766,7 +764,7 @@ abstract class list_show_with_template_Abstract extends list_show
             }
         }
         $content_list = '';
-        for ($theline = $start; $theline < $end; ++$theline) {
+        for ($theline = 0; $theline < $end; ++$theline) {
             $true_content = $content;
             preg_match_all('/##(.*?)##/', $true_content, $out);
             for ($i = 0; $i < count($out[0]); ++$i) {
diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php
index dfc2322880e..adc88a6f6e0 100755
--- a/apps/maarch_entreprise/class/class_lists_Abstract.php
+++ b/apps/maarch_entreprise/class/class_lists_Abstract.php
@@ -151,7 +151,11 @@ abstract class lists_Abstract extends Database
     {
         $this->order = $_REQUEST['order'];
         $this->orderField = $_REQUEST['order_field'];
-        $this->start = $_REQUEST['start'];
+        if ($_REQUEST['start']) {
+            $this->start = $_REQUEST['start'];
+        } else {
+            $this->start = 0;
+        }
         $this->whatSearch = $_REQUEST['what'];
         $this->_manageFilters();
         if (isset($_REQUEST['template'])) {
@@ -1864,7 +1868,7 @@ abstract class lists_Abstract extends Database
 
             $rowsContent = '';
             //Loop into the set of records
-            for ($theLine = $this->start; $theLine < $this->end; ++$theLine) {
+            for ($theLine = 0; $theLine < $this->end; ++$theLine) {
                 //Check if line is disable
                 $lineIsDisabled = $this->_checkDisabledRules($this->params['disabledRules'], $resultArray[$theLine]);
 
@@ -2328,8 +2332,7 @@ abstract class lists_Abstract extends Database
         $start = $end = 0;
 
         //Loading image
-        $loading = '<div id="loading" style="display:none;">'
-                    .'<i class="fa fa-spinner fa-2x" style="vertical-align: middle;" title="loading..."></i></div>';
+        $loading = '<div id="loading" style="display:none;" title ="'._PROCESS_IN_PROGRESS.'""></div>';
 
         //Lines to show
         $nbLines = $this->params['linesToShow'];
@@ -2339,16 +2342,21 @@ abstract class lists_Abstract extends Database
         }
 
         //Number of pages
+        $current_page = ceil($this->start / $this->params['linesToShow'])+1;
         $nb_pages = ceil($this->countResult / $this->params['linesToShow']);
+
+        if ($nb_pages > 500) {
+            $nb_pages = 500;
+        }
         // $debug .='NB total '.$this->countResult.' / NB show: '.$this->params['linesToShow'].' / Pages: '.$nb_pages.' /';
 
         if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
             $start = strip_tags($_REQUEST['start']);
         }
-        $end = $start + $this->params['linesToShow'];
+        /*$end = $start + $this->params['linesToShow'];
         if ($end > $this->countResult) {
             $end = $this->countResult;
-        }
+        }*/
 
         //Get list of tools (icon and link)
         $tools = $this->_getTools($resultFirstRow, $this->countResult);
@@ -2411,7 +2419,7 @@ abstract class lists_Abstract extends Database
             $lastpage = 0;
             for ($i = 0; $i != $nb_pages; ++$i) {
                 $the_line = $i + 1;
-                if ($start == $next_start) {
+                if ($current_page == $the_line) {
                     $pageDropdownList .= '<option value="'.$next_start.'" selected="selected">'.($i + 1).'</option>';
                 } else {
                     $pageDropdownList .= '<option value="'.$next_start.'">'.($i + 1).'</option>';
@@ -2426,15 +2434,15 @@ abstract class lists_Abstract extends Database
             $previous = '&nbsp;';
             $next = '';
             //Previous
-            if ($start > 0) {
-                $start_prev = $start - $this->params['linesToShow'];
+            if ($current_page > 1) {
+                $start_prev = $this->start - $this->params['linesToShow'];
                 $previous = '<a href="javascript://" onClick="loadList(\''.$this->link.'&order='
                     .$this->order.'&order_field='.$this->orderField.'&start='.$start_prev
                     .'\', \''.$this->divListId.'\', '.$this->modeReturn
                     .');"><i class="fa fa-backward" title="'._PREVIOUS.'"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;';
             }
             //Next link
-            if ($start != $lastpage) {
+            if ($current_page != $nb_pages) {
                 $start_next = $start + $this->params['linesToShow'];
                 $next = ' <a href="javascript://" onClick="loadList(\''.$this->link.'&order='
                     .$this->order.'&order_field='.$this->orderField.'&start='
@@ -2501,8 +2509,8 @@ abstract class lists_Abstract extends Database
             }
         }
 
-        $this->start = $start;
-        $this->end = $end;
+        //$this->start = $start;
+        //$this->end = $end;
 
         return $toolbar;
     }
@@ -3229,7 +3237,7 @@ abstract class lists_Abstract extends Database
         $content .= '<tbody>';
 
         //Loop into the set of records
-        for ($theLine = $this->start; $theLine < $this->end; ++$theLine) {
+        for ($theLine = 0; $theLine < $this->end; ++$theLine) {
             //Init
             $href = '';
             $resultTheLine = array();
@@ -3537,7 +3545,9 @@ abstract class lists_Abstract extends Database
 
         $this->countResult = 0;
         if (!empty($resultArray) && is_array($resultArray)) {
-            $this->countResult = count($resultArray);
+            $this->countResult = $_SESSION['save_list']['full_count'];
+            $this->start = $parameters['start'];
+            $this->end = count($resultArray);
         }
         if (count($currentBasket) > 0) {
             $this->currentBasket = $currentBasket;
@@ -3662,7 +3672,7 @@ abstract class lists_Abstract extends Database
             if (!empty($this->template) && $this->template != 'none') {
                 //Build the grid from template
                 $gridContent .= $this->_buildTemplate($_SESSION['html_templates'][$this->template]['PATH'], $resultArray, $listKey, $parameters);
-
+                
                 //Build the list
                 $grid .= $B_form.$B_height.$gridContent.$E_height.$E_form;
 
@@ -3670,7 +3680,7 @@ abstract class lists_Abstract extends Database
             } else {
                 //Header
                 $gridContent .= $this->_createHeader($resultArray[0], $listColumn, $showColumn, $sortColumn);
-
+                
                 //Content
                 $gridContent .= $this->_createContent($resultArray, $listColumn, $listKey);
 
@@ -3687,7 +3697,6 @@ abstract class lists_Abstract extends Database
         } else {
             $grid .= '<div style ="text-align: center;font-size: 16px;padding: 20px;font-weight: bold;opacity: 0.5;">'._NO_RESULTS.'</div>';
         }
-
         //Show the list
         if ($this->params['bool_modeReturn'] === true) {
             return $this->_parse($grid);
@@ -3723,7 +3732,7 @@ abstract class lists_Abstract extends Database
 
         //Show loading image?
         if ($showLoading === true) {
-            $loading = '<i class="fa fa-spinner fa-2x"></i>';
+            $loading = '<div style="padding:10px;justify-content: center;display: flex;align-items: center;font-size: 24px;font-weight: bold;opacity: 0.5;"><div class="lds-ring" style="position:initial;margin-top: 0;"><div></div><div></div><div></div><div></div></div><div>'._PROCESS_IN_PROGRESS.'</div></div>';
         }
 
         //Content div
diff --git a/apps/maarch_entreprise/css/styles.css b/apps/maarch_entreprise/css/styles.css
index b747096eb9b..525abb2716f 100755
--- a/apps/maarch_entreprise/css/styles.css
+++ b/apps/maarch_entreprise/css/styles.css
@@ -3333,7 +3333,7 @@ padding : 4px 3px 1px 1px;
 
 #frmcontact select
 {
-    width:206px;
+    width:200px;
 }
 
 
diff --git a/apps/maarch_entreprise/documents_list_copies.php b/apps/maarch_entreprise/documents_list_copies.php
index c3d8af179c4..6a47d5ad136 100755
--- a/apps/maarch_entreprise/documents_list_copies.php
+++ b/apps/maarch_entreprise/documents_list_copies.php
@@ -162,7 +162,7 @@ if (!empty($order_field) && !empty($order)) {
 }
 
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $_SESSION['config']['databasesearchlimit'], false, '', '', '', false, false, 'distinct');
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
 
 $_SESSION['current_basket']['last_query'] = array();
 $_SESSION['current_basket']['last_query']['select'] = $select;
@@ -524,7 +524,7 @@ $listKey = 'res_id';
 
 //Initialiser le tableau de parametres
 $paramsTab = array();
-$paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_DOCS;              //Titre de la page
+$paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_DOCS;              //Titre de la page
 $paramsTab['listCss'] = 'listing largerList spec';                                  //css
 $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
 $paramsTab['bool_bigPageTitle'] = false;                                            //Affichage du titre en grand
@@ -539,6 +539,7 @@ if (count($template_list) > 0) {
 }
 $paramsTab['bool_showTemplateDefaultList'] = true;                                  //Default list (no template)
 $paramsTab['defaultTemplate'] = $defaultTemplate;                                   //Default template
+$paramsTab['start'] = $_SESSION['save_list']['start'];
 $paramsTab['tools'] = array();                                                      //Icones dans la barre d'outils
 //Fileplan
 if ($core_tools->test_service('fileplan', 'fileplan', false)) {
diff --git a/apps/maarch_entreprise/documents_list_with_attachments.php b/apps/maarch_entreprise/documents_list_with_attachments.php
index 10f3b0effa5..a3916a04af5 100755
--- a/apps/maarch_entreprise/documents_list_with_attachments.php
+++ b/apps/maarch_entreprise/documents_list_with_attachments.php
@@ -35,6 +35,7 @@ require_once 'apps/'.$_SESSION['config']['app_id'].'/definition_mail_categories.
  //URL extra Parameters
     $parameters = '';
     $start = $list->getStart();
+
     if (!empty($order_field) && !empty($order)) {
         $parameters .= '&order='.$order.'&order_field='.$order_field;
     }
@@ -44,9 +45,8 @@ require_once 'apps/'.$_SESSION['config']['app_id'].'/definition_mail_categories.
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
+
+    $parameters .= '&start='.$start;
     $_SESSION['save_list']['start'] = $start;
 
 //Keep some parameters
@@ -162,7 +162,7 @@ if (!empty($order_field) && !empty($order)) {
 }
 
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $_SESSION['config']['databasesearchlimit'], false, '', '', '', false, false, 'distinct');
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
 
 $_SESSION['current_basket']['last_query'] = array();
 $_SESSION['current_basket']['last_query']['select'] = $select;
@@ -499,7 +499,7 @@ $listKey = 'res_id';
 
 //Initialiser le tableau de parametres
 $paramsTab = array();
-$paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_DOCS;   //Titre de la page
+$paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_DOCS;   //Titre de la page
 $paramsTab['listCss'] = 'listing largerList spec';                     //css
 $paramsTab['bool_sortColumn'] = true;                                          //Affichage Tri
 $paramsTab['bool_bigPageTitle'] = false;                                         //Affichage du titre en grand
@@ -507,6 +507,7 @@ $paramsTab['bool_showIconDocument'] = true;
 $paramsTab['bool_showIconDetails'] = true;                                          //Affichage de l'icone de la page de details
 $paramsTab['urlParameters'] = 'baskets='.$_SESSION['current_basket']['id']   //Parametres d'url supplementaires
                                              .$urlParameters;
+$paramsTab['start'] = $_REQUEST['start'];
 $paramsTab['filters'] = array(                                         //Filtres
                                                 'entity',
                                                 'entity_subentities',
@@ -522,6 +523,7 @@ if (count($template_list) > 0) {
 
 $paramsTab['bool_showTemplateDefaultList'] = true;                                          //Default list (no template)
 $paramsTab['defaultTemplate'] = $defaultTemplate;                              //Default template
+$paramsTab['start'] = $_SESSION['save_list']['start'];
 $paramsTab['tools'] = array();                                       //Icones dans la barre d'outils
 
 //Fileplan
diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php
index a5d7dbe1b1b..e2139129a57 100755
--- a/apps/maarch_entreprise/index.php
+++ b/apps/maarch_entreprise/index.php
@@ -25,12 +25,14 @@ if (!empty($_REQUEST['code']) && !empty($_REQUEST['state'])) {
 }
 
 //reset orders in previous basket list
+
 if (empty($_SESSION['current_basket'])) {
-    $_SESSION['save_list']['start'] = "";
+    $_SESSION['save_list']['start'] = 0;
     $_SESSION['save_list']['lines'] = "";
     $_SESSION['save_list']['order'] = "";
     $_SESSION['save_list']['order_field'] = "";
     $_SESSION['save_list']['template'] = "";
+    $_SESSION['save_list']['full_count'] = 0;
 }
 
 // Useless ???
diff --git a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
index fa26a40c5b3..f7eacc9c07c 100755
--- a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
+++ b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
@@ -329,9 +329,8 @@ if ($mode == 'normal') {
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
+    
+    $parameters .= '&start='.$start;
     $_SESSION['save_list']['start'] = $start;
 
     if (isset($_SESSION['where_from_contact_check']) && $_SESSION['where_from_contact_check'] != '' && (isset($_REQUEST['fromContactCheck']) || $_SESSION['fromContactCheck'] == 'ok')) {
@@ -340,11 +339,11 @@ if ($mode == 'normal') {
     }
 
 //Query
-    $tab = $request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', $add_security);
+    $tab = $request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', $add_security, false, false, $_SESSION['save_list']['start']);
     // $request->show();
 //Result array
-
     $tabI = count($tab);
+
     for ($i = 0; $i < $tabI; ++$i) {
         $tabJ = count($tab[$i]);
         for ($j = 0; $j < $tabJ; ++$j) {
@@ -771,7 +770,7 @@ if ($mode == 'normal') {
         }
     }
 
-$nbTab = count($tab);
+$nbTab = $_SESSION['save_list']['full_count'];
 if ($nbTab > 0) {
     /************Construction de la liste*******************/
     //Clé de la liste
@@ -819,7 +818,7 @@ if ($nbTab > 0) {
             $paramsTab['buttons'] = array();
             $paramsTab['buttons'] = $buttons;
         }
-
+    $paramsTab['start'] = $_SESSION['save_list']['start'];
     //Toolbar
         $paramsTab['tools'] = array();                                                  //Icones dans la barre d'outils
 
diff --git a/apps/maarch_entreprise/indexing_searching/list_results_mlb.php b/apps/maarch_entreprise/indexing_searching/list_results_mlb.php
index 877d953a7d7..26b40feac3f 100755
--- a/apps/maarch_entreprise/indexing_searching/list_results_mlb.php
+++ b/apps/maarch_entreprise/indexing_searching/list_results_mlb.php
@@ -75,7 +75,7 @@ $urlParameters = '';
         $_SESSION['save_list']['fromDetail'] = "false";
         $_SESSION['save_list']['url'] = $urlParameters;
     }
-	$_SESSION['save_list']['start'] = "";
+	$_SESSION['save_list']['start'] = 0;
 	$_SESSION['save_list']['lines'] = "";
 	$_SESSION['save_list']['order'] = "";
 	$_SESSION['save_list']['order_field'] = "";
diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js
index a3ed2f0fa25..1013cae2b65 100755
--- a/apps/maarch_entreprise/js/functions.js
+++ b/apps/maarch_entreprise/js/functions.js
@@ -2463,6 +2463,7 @@ function cleanSessionBasket(url,value){
         parameters: { courrier_purpose : value},
         onSuccess: function(answer){
             eval("response = "+answer.responseText);
+            $j('#select_basket').submit();
             //monTableauJS =  JSON.parse(answer.responseText);
 
 
@@ -2694,7 +2695,7 @@ function convertToTextVisibleNewLine(value) {
 
 function loadList(path, inDiv, modeReturn, init) {
 
-// alert (modeReturn);
+    // alert (modeReturn);
     if(typeof(inDiv)==='undefined'){
         var div = 'divList';
     } else {
@@ -2716,8 +2717,9 @@ function loadList(path, inDiv, modeReturn, init) {
         onCreate: function(answer) {
                 //show loading image in toolbar
             if(document.getElementById("loading")){
-            document.getElementById("loading").style.display='block';
-
+                var loader = $j('<div style="position: absolute;margin-top: -15px;"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve"><rect x="0" y="10" width="4" height="10" fill="#135F7F" opacity="0.2">  <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s" repeatCount="indefinite" /><animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />  <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.6s" repeatCount="indefinite" /></rect><rect x="8" y="10" width="4" height="10" fill="#135F7F"  opacity="0.2">  <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.15s" dur="0.6s" repeatCount="indefinite" />  <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />  <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" /></rect><rect x="16" y="10" width="4" height="10" fill="#135F7F"  opacity="0.2">  <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.6s" repeatCount="indefinite" />  <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />  <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" /></rect></svg></div>');
+                loader.appendTo('#loading');
+                document.getElementById("loading").style.display='block';
             }
                 
         },                        
@@ -2732,6 +2734,7 @@ function loadList(path, inDiv, modeReturn, init) {
                         //evalMyScripts(div);
 
                         if(document.getElementById("loading")){
+                            loader.remove();
                             document.getElementById("loading").style.display='none';
                         }
                     }else {
diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php
index 9f0855c88cf..50b23dbb7bd 100755
--- a/apps/maarch_entreprise/lang/en.php
+++ b/apps/maarch_entreprise/lang/en.php
@@ -5022,3 +5022,6 @@ if (!defined('_CHRONO_NUMBER_HELP')) {
 if (!defined('_BARCODE_HELP')) {
     define('_BARCODE_HELP', "Example : ABC000004");
 }
+if (!defined('_PROCESS_IN_PROGRESS')) {
+    define('_PROCESS_IN_PROGRESS', "Data processing ...");
+}
\ No newline at end of file
diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php
index 2f4c56f022c..ce0aa10cfb4 100755
--- a/apps/maarch_entreprise/lang/fr.php
+++ b/apps/maarch_entreprise/lang/fr.php
@@ -5182,3 +5182,6 @@ if (!defined('_CHRONO_NUMBER_HELP')) {
 if (!defined('_BARCODE_HELP')) {
     define('_BARCODE_HELP', "Exemple : ABC000004");
 }
+if (!defined('_PROCESS_IN_PROGRESS')) {
+    define('_PROCESS_IN_PROGRESS', "Traitement en cours");
+}
\ No newline at end of file
diff --git a/apps/maarch_entreprise/my_contacts/my_contacts.php b/apps/maarch_entreprise/my_contacts/my_contacts.php
index a7e0c707ba1..c7908f2ec54 100755
--- a/apps/maarch_entreprise/my_contacts/my_contacts.php
+++ b/apps/maarch_entreprise/my_contacts/my_contacts.php
@@ -145,8 +145,13 @@ $contact    = new contacts_v2();
         $orderstr = "order by contact_lastname, society asc";
     }
 
+    if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+        $parameters .= '&start='.$_REQUEST['start'];
+    } else {
+        $_REQUEST['start'] = 0;
+    }
     //Request
-    $tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype'], "default", false, "", "", "", true, false, true);
+    $tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype'], "default", false, "", "", "", true, false, true, $_REQUEST['start']);
     
     //Result array    
     for ($i=0;$i<count($tab);$i++)
@@ -242,13 +247,14 @@ $contact    = new contacts_v2();
     //List parameters
     $paramsTab = array();
     $paramsTab['bool_modeReturn'] = false;                                              //Desactivation du mode return (vs echo)
-    $paramsTab['pageTitle'] =  _CONTACTS_LIST." : ".count($tab).' '._CONTACTS;           //Titre de la page
+    $paramsTab['pageTitle'] =  _CONTACTS_LIST." : ".$_SESSION['save_list']['full_count'].' '._CONTACTS;           //Titre de la page
     $paramsTab['urlParameters'] = '&dir=my_contacts';                                   //parametre d'url supplementaire
     if ($_REQUEST['mode'] == 'search') {
         $paramsTab['urlParameters'] .= "&mode=search";
     } 
     $paramsTab['pagePicto'] = 'users';                                //Image (pictogramme) de la page
     $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
+    $paramsTab['start'] = $_REQUEST['start'];
     $paramsTab['bool_showSearchTools'] = true;                                          //Afficle le filtre alphabetique et le champ de recherche
     $paramsTab['searchBoxAutoCompletionUrl'] = $_SESSION['config']['businessappurl']
                     ."index.php?display=true&page=contacts_v2_list_by_name";            //Script pour l'autocompletion
@@ -262,7 +268,7 @@ $contact    = new contacts_v2();
         // ."index.php?dir=my_contacts&page=my_contact_add";                            //Lien sur le bouton nouveau (1)
     if ($_REQUEST['mode'] <> 'search') {
         $paramsTab['bool_showAddButton'] = true;                                            //Affichage du bouton Nouveau
-        $paramsTab['addButtonLabel'] = _CONTACT_ADDITION;                                   //Libellé du bouton Nouveau
+        $paramsTab['addButtonLabel'] = _CONTACT_ADDITION;                                   //Libell� du bouton Nouveau
         $paramsTab['addButtonScript'] = "window.top.location='".$_SESSION['config']['businessappurl']
             ."index.php?dir=my_contacts&page=my_contact_add'";                              //Action sur le bouton nouveau (2)
     }
diff --git a/core/class/class_db_pdo.php b/core/class/class_db_pdo.php
index bb75289fc3b..b7369df30d9 100755
--- a/core/class/class_db_pdo.php
+++ b/core/class/class_db_pdo.php
@@ -485,13 +485,12 @@ class Database extends functions
             $query = 'SELECT' . 
                 ' ' . $select_opts . 
                 ' ' . $select_expr . 
-                ' FROM ' . $table_refs .
+                ', count(1) OVER() AS __full_count FROM ' . $table_refs .
                 ' WHERE ' . $where_def .
                 ' ' . $other_clauses .
                 ' ' . $order_by .
                 ' ' . $limit_clause;
         }
-        
         return $query;
         
     }
diff --git a/core/class/class_request.php b/core/class/class_request.php
index 66a3fdb52ae..0f5829c8a23 100755
--- a/core/class/class_request.php
+++ b/core/class/class_request.php
@@ -56,11 +56,11 @@ class request extends dbquery
     * @param  $distinct_argument  Add the distinct parameters in the sql query (false by default)
     * @return array Results of the built query
     */
-    public function PDOselect($select, $where, $parameters = null, $other, $database_type, $limit="default", $left_join=false, $first_join_table="", $second_join_table="", $join_key="", $add_security = true, $catch_error = false, $distinct_argument = false)
+    public function PDOselect($select, $where, $parameters = null, $other, $database_type, $limit="default", $left_join=false, $first_join_table="", $second_join_table="", $join_key="", $add_security = true, $catch_error = false, $distinct_argument = false, $start = 0)
     {
         $db = new Database();
         if ($limit == 0 || $limit == "default") {
-            $limit = $_SESSION['config']['databasesearchlimit'];
+            $limit = $_SESSION['config']['nblinetoshow'];
         }
       
         //Extracts data in the first argument : $select.
@@ -133,7 +133,7 @@ class request extends dbquery
             $dist = " distinct ";
         }
         
-        $query = $db->limit_select(0, $limit, $field_string, $table_string." ".$join, $where_string, $other, $dist);
+        $query = $db->limit_select($start, $limit, $field_string, $table_string." ".$join, $where_string, $other, $dist);
 
         if (preg_match('/_view/i', $query)) {
             $_SESSION['last_select_query'] = $query;
@@ -149,7 +149,9 @@ class request extends dbquery
         while ($line = $res_query->fetch(PDO::FETCH_ASSOC)) {
             $temp= array();
             foreach (array_keys($line) as $resval) {
-                if (!is_int($resval)) {
+                if ($resval == '__full_count') {
+                    $_SESSION['save_list']['full_count'] = $line[$resval];
+                } else if (!is_int($resval)) {
                     array_push(
                         $temp,
                         array(
diff --git a/modules/attachments/frame_list_attachments.php b/modules/attachments/frame_list_attachments.php
index 7ebd8abbb0f..9e2c04f3775 100755
--- a/modules/attachments/frame_list_attachments.php
+++ b/modules/attachments/frame_list_attachments.php
@@ -139,6 +139,8 @@ if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) {
 }
 if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
     $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
 }
 if (isset($_REQUEST['template_selected']) && !empty($_REQUEST['template_selected'])) {
     $parameters .= '&template_selected='.$_REQUEST['template_selected'];
@@ -191,7 +193,15 @@ if (isset($_REQUEST['load'])) {
         $arrayPDO,
         $orderstr,
         $_SESSION['config']['databasetype'],
-        '500'
+        'default',
+        false,
+        '',
+        '',
+        '',
+        false,
+        false,
+        false,
+        $_REQUEST['start']
     );
     // $request->show();
 
@@ -416,6 +426,7 @@ if (isset($_REQUEST['load'])) {
     $paramsTab['listCss'] = 'listing largerList spec';                                                       //CSS
     $paramsTab['urlParameters'] =  'display=true'.$parameters;            //Parametres supplémentaires
     $paramsTab['defaultTemplate'] = $defaultTemplate;                                   //Default template
+    $paramsTab['start'] = $_REQUEST['start'];
     if (!empty($_REQUEST['noModification'])) {
         $paramsTab['noModification'] = true;
     }
diff --git a/modules/avis/difflist_avis_history_display.php b/modules/avis/difflist_avis_history_display.php
index 329fd7c511e..28218602814 100755
--- a/modules/avis/difflist_avis_history_display.php
+++ b/modules/avis/difflist_avis_history_display.php
@@ -93,8 +93,6 @@ $urlParameters = '';
     $order = $order_field = '';
     $order = $list->getOrder();
     $order_field = $list->getOrderField();
-    // $_SESSION['save_list']['order'] = $order;
-    // $_SESSION['save_list']['order_field'] = $order_field;
 
     if (!empty($order_field) && !empty($order)) {
         $orderstr = "order by ".$order_field." ".$order;
@@ -110,13 +108,11 @@ $urlParameters = '';
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
-    // $_SESSION['save_list']['start'] = $start;
 
+    $parameters .= '&start='.$start;
+    
 //Query
-    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security);
+    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", false, false, false, $start);
     // $request->show();
     
 //Result array
@@ -191,6 +187,7 @@ if (count($tab) > 0) {
     }
 
     $paramsTab['listCss'] = 'listing largerList spec';                       //css
+    $paramsTab['start'] = $start;
     $paramsTab['bool_showTemplateDefaultList'] = false;                      //Default list (no template)
 
     //Form attributs
diff --git a/modules/avis/documents_list_with_avis.php b/modules/avis/documents_list_with_avis.php
index 4648971bcfd..122c4168382 100755
--- a/modules/avis/documents_list_with_avis.php
+++ b/modules/avis/documents_list_with_avis.php
@@ -44,9 +44,8 @@ if (!empty($what)) {
 if (!empty($selectedTemplate)) {
     $parameters .= '&template='.$selectedTemplate;
 }
-if (!empty($start)) {
-    $parameters .= '&start='.$start;
-}
+
+$parameters .= '&start='.$start;
 $_SESSION['save_list']['start'] = $start;
 
 //Keep some parameters
@@ -150,10 +149,9 @@ if (!empty($order_field) && !empty($order)) {
     $orderstr = 'order by modification_date desc';
     $_SESSION['last_order_basket'] = $orderstr;
 }
-
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $_SESSION['config']['databasesearchlimit'], false, '', '', '', false, false, 'distinct');
-// $request->show(); exit;
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
+
 //Templates
 $defaultTemplate = 'documents_list_with_avis';
 $selectedTemplate = $list->getTemplate();
@@ -499,7 +497,7 @@ $listKey = 'res_id';
 
 //Initialiser le tableau de parametres
 $paramsTab = array();
-$paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_DOCS;              //Titre de la page
+$paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_DOCS;              //Titre de la page
 $paramsTab['listCss'] = 'listing largerList spec';                                  //css
 $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
 $paramsTab['bool_bigPageTitle'] = false;                                            //Affichage du titre en grand
@@ -513,6 +511,7 @@ if (count($template_list) > 0) {
     $paramsTab['templates'] = $template_list;
 }
 $paramsTab['bool_showTemplateDefaultList'] = true;                                  //Default list (no template)
+$paramsTab['start'] = $_SESSION['save_list']['start'];
 $paramsTab['defaultTemplate'] = $defaultTemplate;                                   //Default template
 $paramsTab['tools'] = array();                                                      //Icones dans la barre d'outils
 //Fileplan
@@ -575,7 +574,6 @@ if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) {
 //Afficher la liste
 $status = 0;
 $content = $list->showList($tab, $paramsTab, $listKey, $_SESSION['current_basket']);
-// $debug = $list->debug(false);
 
 $content .= '<script>$j(\'#container\').attr(\'style\', \'width: 90%; min-width: 1000px;\');$j(\'#content\').attr(\'style\', \'width: auto; min-width: 1000px;\');';
 $content .= '$j(\'#inner_content\').attr(\'style\', \'width: auto; min-width: 1000px;\');</script>';
diff --git a/modules/basket/cleanSessionBasket.php b/modules/basket/cleanSessionBasket.php
index c059075a24a..a1030bd1407 100755
--- a/modules/basket/cleanSessionBasket.php
+++ b/modules/basket/cleanSessionBasket.php
@@ -1,6 +1,6 @@
 <?php
 $_SESSION['basket_used'] = '';
-$_SESSION['save_list']['start'] = "";
+$_SESSION['save_list']['start'] = 0;
 $_SESSION['save_list']['lines'] = "";
 $_SESSION['save_list']['order'] = "";
 $_SESSION['save_list']['order_field'] = "";
diff --git a/modules/basket/view_baskets.php b/modules/basket/view_baskets.php
index b4ee2658958..f8d6adbd7fc 100755
--- a/modules/basket/view_baskets.php
+++ b/modules/basket/view_baskets.php
@@ -134,6 +134,7 @@ $pagePath = $_SESSION['config']['businessappurl']
     . 'index.php?page=view_baskets&module=basket&baskets='.$_REQUEST['baskets'];
 $pageLabel = _MY_BASKETS;
 $pageId = "my_baskets";
+
 $core->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level);
 /***********************************************************/
 $bask = new basket();
@@ -212,7 +213,7 @@ if (count($_SESSION['user']['baskets']) > 0) {
             <input type="hidden" name="page" id="page" value="view_baskets" />
             <input type="hidden" name="module" id="module" value="basket" />
 
-            <select name="baskets"id="baskets" onchange="cleanSessionBasket('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&module=basket&page=cleanSessionBasket','ok'); this.form.submit();" class="listext_big" >
+            <select name="baskets" id="baskets" onchange="cleanSessionBasket('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&module=basket&page=cleanSessionBasket','ok');" class="listext_big" >
                 <option value=""><?php echo _CHOOSE_BASKET;?></option>
                 <?php
                 $redirectedBaskets = \Basket\models\BasketModel::getRedirectedBasketsByUserId(['userId' => $_SESSION['user']['UserId']]);
diff --git a/modules/cases/cases_documents_list.php b/modules/cases/cases_documents_list.php
index 25d97f7c5e4..41e560d9f13 100755
--- a/modules/cases/cases_documents_list.php
+++ b/modules/cases/cases_documents_list.php
@@ -27,7 +27,6 @@
 * @version $Revision$
 * @ingroup cases_documents_list.php
 */
-
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php");
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php");
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manage_status.php");
@@ -36,13 +35,8 @@ require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_
 require_once("modules".DIRECTORY_SEPARATOR."cases".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.'class_modules_tools.php');
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manage_status.php");
 
-include_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php');
-
 $status_obj = new manage_status();
 $core_tools = new core_tools();
-$core_tools->test_user();
-$core_tools->load_lang();
-$core_tools->load_html();
 $core_tools->load_header('', true, false);
 $sec = new security();
 $status_obj = new manage_status();
@@ -71,77 +65,31 @@ for ($i=0; $i<count($status);$i++) {
 }
 if ($status_str <> '') {
     $status_str = preg_replace('/,$/', '', $status_str);
-    $where_request.= "  status not in (".$status_str.") ";
+    $excludeStatusClause = "status not in (".$status_str.")";
     
 } else {
-    $where_request .= " 1=1 ";
+    $excludeStatusClause = " 1=1 ";
 }
 //$where_clause = $sec->get_where_clause_from_coll_id($_SESSION['collection_id_choice']);
 
-$where_request .= $obj_cases->get_where_clause_from_case($_SESSION['cases']['actual_case_id']);
-$where_request .= " and (";
+$caseIdClause = $obj_cases->get_where_clause_from_case($_SESSION['cases']['actual_case_id']);
 
-$j=0;
-$basketClause = false;
 if (count($_SESSION['user']['baskets']) > 0) {
-    while($j<=count($_SESSION['user']['baskets'])) {
-        //controle for basket that has empty whereclause ' '
-        $basketClauseReplace = str_replace(array(" ", '"', "'"), array("", "", ""), $_SESSION['user']['baskets'][$j]['clause']);
-
-        if($basketClauseReplace <> "") {
-            $where_request .= "(" . $_SESSION['user']['baskets'][$j]['clause'] . ")";
-            $basketClause = true;
-
-            $basketClauseReplace1 = str_replace(array(" ", '"', "'"), array("", "", ""), $_SESSION['user']['baskets'][$j+1]['clause']);
-
-            $jplus = $j + 1;
-            $normalBasketsRemaining = false;
-            while ($_SESSION['user']['baskets'][$jplus]) {
-                $normalBasketsRemaining = true;
-                break;
+	$arrClause = [];
+	foreach ($_SESSION['user']['baskets'] as $basket) {
+		if(!empty(trim($basket['clause']))) {
+			$arrClause[] = $basket['clause'];
             }
-            if ($j + 1 < count($_SESSION['user']['baskets']) && $basketClauseReplace1 != "" && $normalBasketsRemaining) {
-                $where_request .= " or ";
             }
-        } else if ($j > 0) {
-            $where_request .= " or ";
+	$userBasketsClause = '('.implode(') OR (',$arrClause).')';
+
         }
-        $j++;
-    }
-}
 
 if ($_SESSION['user']['security'][$_SESSION['collection_id_choice']]['DOC']['where'] <> '') {
-    
-	if ($basketClause) {
-		$where_request .= " or ";
-	}
-    $where_request .= $_SESSION['user']['security'][$_SESSION['collection_id_choice']]['DOC']['where']." ";
-}
-
-$where_request .= " )";
-
-if($where_clause <> '')
-{
-		//$where_clause .= $obj_cases->get_where_clause_from_case($_SESSION['cases']['actual_case_id']);
+    $userSecurityClause = $_SESSION['user']['security'][$_SESSION['collection_id_choice']]['DOC']['where'];
 }
 
-/*if(!empty($where_request))
-{
-	if($_SESSION['searching']['where_clause_bis'] <> "")
-	{
-		$where_clause = "((".$where_clause.") or (".$_SESSION['searching']['where_clause_bis']."))";
-	}
-	$where_request = '('.$where_request.') and ('.$where_clause.')';
-}
-else
-{
-	if($_SESSION['searching']['where_clause_bis'] <> "")
-	{
-		$where_clause = "((".$where_clause.") or (".$_SESSION['searching']['where_clause_bis']."))";
-	}
-	$where_request = $where_clause;
-}
-*/
+$where_request = '('.$excludeStatusClause.$caseIdClause.') AND ('. $userBasketsClause .' OR '.$userSecurityClause.')';
 
 $where_request = str_replace("()", "(1=-1)", $where_request);
 $where_request = str_replace("and ()", "", $where_request);
@@ -158,12 +106,13 @@ if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field']))
 {
 	$field = trim($_REQUEST['order_field']);
 }
-
 $orderstr = $list->define_order($order, $field);
-
+$start = 0;
+ if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+     $start = trim($_REQUEST['start']);
+ }
 $request = new request();
-$tab=$request->PDOselect($select,$where_request,$where_what,$orderstr,$_SESSION['config']['databasetype'],"default",false,"","","",false,false,false);
-//$request->show();
+$tab=$request->PDOselect($select,$where_request,$where_what,$orderstr,$_SESSION['config']['databasetype'],"default",false,"","","",false,false,false, $start);
 $_SESSION['error_page'] = '';
 
 //build the tab with right format for list_doc function
@@ -204,7 +153,8 @@ if (count($tab) > 0)
 				{
 					$tab[$i][$j]["label"]=_STATUS;
 					$res_status = $status_obj->get_status_data($tab[$i][$j]['value']);
-					$tab[$i][$j]['value'] = "<img src = '".$res_status['IMG_SRC']."' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'>";
+					$img_class = substr($res_status['IMG_SRC'], 0, 2);
+					$tab[$i][$j]['value'] = '<i '.$style." class = '".$img_class.' '.$res_status['IMG_SRC'].' '.$img_class."-3x' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'></i>";
 					$tab[$i][$j]["size"]="5";
 					$tab[$i][$j]["label_align"]="left";
 					$tab[$i][$j]["align"]="left";
@@ -282,8 +232,6 @@ if (count($tab) > 0)
 					$tab[$i][$j]["valign"]="bottom";
 					$tab[$i][$j]["show"]=false;
 					$tab[$i][$j]["value_export"] = $tab[$i][$j]['value'];
-					$my_imgcat = get_img_cat($tab[$i][$j]['value']);
-					$tab[$i][$j]['value'] = $my_imgcat;
 					$tab[$i][$j]["value"] = $tab[$i][$j]['value'];
 					$tab[$i][$j]["order"]="category_id";
 				}
@@ -333,8 +281,7 @@ if (count($tab) > 0)
 
 
 $details = 'details';
-	$list->list_doc($tab,$i,'','res_id','cases_documents_list','res_id',$details.'&dir=indexing_searching',true,false,'','','',true,true,true, false,false,false,true,false,'', 'cases',false,'','','listing2 smallfont ', '', false, false, null, '', '{}', false, '', true, '', false);
+	$list->list_doc($tab, $_SESSION['save_list']['full_count'],_RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_DOCS,'res_id','cases_documents_list','res_id',$details.'&dir=indexing_searching',true,false,'','','',true,true,true, false,false,false,true,false,'', 'cases',false,'','','listing2 smallfont ', '', false, false, null, '', '{}', false, '', true, '', false);
 }
-$core_tools->load_js();
 ?>
 </body>
diff --git a/modules/cases/cases_list_search_adv.php b/modules/cases/cases_list_search_adv.php
index cc267231e5e..ffe1f1a5f5b 100755
--- a/modules/cases/cases_list_search_adv.php
+++ b/modules/cases/cases_list_search_adv.php
@@ -1,35 +1,15 @@
 <?php
-/*
-*
-*    Copyright 2008,2012 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
+/**
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
+
 *
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
+* @brief   cases_list_search_adv
 *
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
+* @author  dev <dev@maarch.org>
+* @ingroup cases
 */
-
-/**
- * @brief   Displays document list in baskets
- *
- * @file
- *
- * @author Yves Christian Kpakpo <dev@maarch.org>
- * @date $date$
- *
- * @version $Revision$
- * @ingroup basket
- */
 require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php';
 require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php';
 require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_status.php';
@@ -42,20 +22,25 @@ $core_tools = new core_tools();
 $request = new request();
 $list = new lists();
 
+//URL extra Parameters
+$parameters = '';
+$start = $list->getStart();
+$parameters .= '&start='.$start;
+
 //Templates
-    $defaultTemplate = 'cases_list_search_adv';
-    $selectedTemplate = $list->getTemplate();
-    if (empty($selectedTemplate)) {
-        if (!empty($defaultTemplate)) {
-            $list->setTemplate($defaultTemplate);
-            $selectedTemplate = $list->getTemplate();
-        }
-    }
-    $template_list = array();
-    array_push($template_list, 'documents_list_search_adv');
-    if ($core_tools->is_module_loaded('cases')) {
-        array_push($template_list, 'cases_list_search_adv');
+$defaultTemplate = 'cases_list_search_adv';
+$selectedTemplate = $list->getTemplate();
+if (empty($selectedTemplate)) {
+    if (!empty($defaultTemplate)) {
+        $list->setTemplate($defaultTemplate);
+        $selectedTemplate = $list->getTemplate();
     }
+}
+$template_list = array();
+array_push($template_list, 'documents_list_search_adv');
+if ($core_tools->is_module_loaded('cases')) {
+    array_push($template_list, 'cases_list_search_adv');
+}
 
 //Create sql request
  $_SESSION['collection_id_choice'] = 'letterbox_coll';
@@ -110,7 +95,7 @@ $arrayPDO = array();
         $add_security = true;
     }
 
-//Order
+    //Order
     $order = $order_field = '';
     $order = $list->getOrder();
     $order_field = $list->getOrderField();
@@ -123,7 +108,7 @@ $arrayPDO = array();
     }
 
 //Query
-    $tab = $request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', $add_security, false, true);
+    $tab = $request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', $add_security, false, true, $start);
     //$request->show();
 //Result
     for ($i = 0; $i < count($tab); ++$i) {
@@ -212,7 +197,7 @@ if (count($tab) > 0) {
     //Initialiser le tableau de param�tres
     $paramsTab = array();
     $paramsTab['bool_modeReturn'] = false;                                                  //Desactivation du mode return (vs echo)
-    $paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_CASE;                  //Titre de la page
+    $paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_CASE;                  //Titre de la page
     $paramsTab['pagePicto'] = 'search';
     $paramsTab['bool_sortColumn'] = true;                                                   //Affichage Tri
     $paramsTab['defaultTemplate'] = 'cases_list_search_adv';
@@ -221,6 +206,7 @@ if (count($tab) > 0) {
         $paramsTab['templates'] = $template_list;
     }                              //Default template
     $paramsTab['bool_showTemplateDefaultList'] = true;                                      //Default list (no template)
+    $paramsTab['start'] = $start;
     $paramsTab['tools'] = array();                                                          //Icones dans la barre d'outils
     $export = array(
             'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=export', '_blank');",
diff --git a/modules/cases/cases_notes_list.php b/modules/cases/cases_notes_list.php
index 63e8deeed00..c47ba9ac284 100755
--- a/modules/cases/cases_notes_list.php
+++ b/modules/cases/cases_notes_list.php
@@ -110,9 +110,12 @@ else
 $docs_limitation .= $docs_library[0];
 $docs_limitation .= ' ) ';
 
+$start = 0;
+ if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+     $start = trim($_REQUEST['start']);
+ }
 
-
-$tabNotes=$request->PDOselect($select,$where_request.$docs_limitation,$where_what,"order by ".$view.".res_id",$_SESSION['config']['databasetype'], "500", false );
+$tabNotes=$request->PDOselect($select,$where_request.$docs_limitation,$where_what,"order by ".$view.".res_id",$_SESSION['config']['databasetype'], "500", false,"","","",true,false,false, $start);
 $ind_notes1d = '';
 
 
@@ -124,7 +127,7 @@ if($_GET['size'] == "full")
 	$size_medium = "15";
 	$size_small = "15";
 	$size_full = "70";
-	$css = "listing spec detailtabricatordebug";
+	$css = "listing spec";
 	$body = "";
 	$cut_string = 100;
 	$extend_url = "&size=full";
@@ -301,7 +304,7 @@ $core_tools->load_header('', true, false);
 ?>
 <body id="<?php functions::xecho($body);?>">
 <?php
-$title = '';
+$title = _RESULTS.' : '.$_SESSION['save_list']['full_count']. ' '. _NOTES;
 $list_notes = new list_show();
 $list_notes->list_simple($tabNotes, count($tabNotes), $title,'id','id', false, '',$css);
 $core_tools->load_js();
diff --git a/modules/cases/list_results_mlb_frame.php b/modules/cases/list_results_mlb_frame.php
index 6868ba694e1..a438b748fd5 100755
--- a/modules/cases/list_results_mlb_frame.php
+++ b/modules/cases/list_results_mlb_frame.php
@@ -190,7 +190,7 @@ if (($_REQUEST['template'] == 'group_case') && ($core_tools->is_module_loaded('c
     $where .= 'cases.case_closing_date is null and ';
 
     $request = new request();
-    $tab = $request->PDOselect($select, $where.$where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, true);
+    $tab = $request->PDOselect($select, $where.$where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, true, $start);
 } else {
     $request = new request();
     $tab = $request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']);
@@ -415,11 +415,11 @@ if (count($tab) > 0) {
         }
     } ?>
 
-    <h4><p align="center"><i class="fa fa-search fa-2x"></i> <?php echo _SEARCH_RESULTS.' - '.count($tab).' '._FOUND_DOC; ?></h4></p>
+    <h4><p align="center"><i class="fa fa-search fa-2x"></i> <?php echo _SEARCH_RESULTS.' - '.$_SESSION['save_list']['full_count'].' '._FOUND_DOC; ?></h4></p>
         <div id="inner_content">
             <?php
             $details = 'details';
-    $list->list_doc($tab, $i, '', 'res_id', 'list_results_mlb_frame&module=cases&searched_item='.$_GET['searched_item'].'&searched_value='.$_GET['searched_value'], 'res_id', $details.'&dir=indexing_searching', true, true, 'post', $_SESSION['config']['businessappurl'].'index.php?display=true&module=cases&page=execute_attachement&searched_item='.$_GET['searched_item'].'&searched_value='.$_GET['searched_value'], _LINK_TO_CASE, false, true, true, false, false, false, true, true, '', '', false, '', '', 'listing spec', '', false, false, null, '<input type="hidden" name="display" value="true"/><input type="hidden" name="module" value="cases" /><input type="hidden" name="page" value="execute_attachement" />', '{}', true, '', true, array(), true, $template_list, $template_to_use, false, true);
+    $list->list_doc($tab, $_SESSION['save_list']['full_count'], '', 'res_id', 'list_results_mlb_frame&module=cases&searched_item='.$_GET['searched_item'].'&searched_value='.$_GET['searched_value'], 'res_id', $details.'&dir=indexing_searching', true, true, 'post', $_SESSION['config']['businessappurl'].'index.php?display=true&module=cases&page=execute_attachement&searched_item='.$_GET['searched_item'].'&searched_value='.$_GET['searched_value'], _LINK_TO_CASE, false, true, true, false, false, false, true, true, '', '', false, '', '', 'listing spec', '', false, false, null, '<input type="hidden" name="display" value="true"/><input type="hidden" name="module" value="cases" /><input type="hidden" name="page" value="execute_attachement" />', '{}', true, '', true, array(), true, $template_list, $template_to_use, false, true);
     echo "<p align='center'><a href=\"".$_SESSION['config']['businessappurl'].'index.php?display=true&module=cases&page=search_adv_for_cases&searched_item='.functions::xssafe($_GET['searched_item']).'&searched_value='.functions::xssafe($_GET['searched_value']).'">'._MAKE_NEW_SEARCH.'</a></strong></div></p>'; ?>
         </div>
         <?php
diff --git a/modules/entities/difflist_display.php b/modules/entities/difflist_display.php
index 8d618f8611e..2ed55ad5f36 100755
--- a/modules/entities/difflist_display.php
+++ b/modules/entities/difflist_display.php
@@ -12,7 +12,7 @@
 */
 $contentDiffList = '';
 
-$contentDiffList .= '<div style="max-height:490px;overflow:auto;">';
+$contentDiffList .= '<div id="diff_list_div" style="max-height:490px;overflow:auto;">';
 
 $empty = 0;
 $nb_roles = 0;
@@ -60,7 +60,7 @@ foreach ($roles as $role_id => $role_label) {
                 $contentDiffList .= '<td style="width:43%;">'.$user['entity_label'].'</td>';
                 $contentDiffList .= '<td class="movedest" style="width:5%;">';
 
-                if (!empty($difflist['dest']['users'][0]) && $role_id != 'dest' && $origin != null && !$core->test_service('add_copy_in_indexing_validation', 'entities', false)) {
+                if (!isset($specific_role) && !empty($difflist['dest']['users'][0]) && $role_id != 'dest' && $origin != null && !$core->test_service('add_copy_in_indexing_validation', 'entities', false)) {
                     $contentDiffList .= '<i class="fa fa-arrow-up" style="cursor:pointer;" title="'._DEST.'" onclick="moveToDest(\''.$user['user_id'].'\',\''.$role_id.'\',\''.$origin.'\');"></i>';
                 }
                 $contentDiffList .= '</td>';
diff --git a/modules/entities/difflist_history_display.php b/modules/entities/difflist_history_display.php
index 8df4b293506..37d0fc7286c 100755
--- a/modules/entities/difflist_history_display.php
+++ b/modules/entities/difflist_history_display.php
@@ -109,12 +109,11 @@ $urlParameters = '';
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
+    $parameters .= '&start='.$start;
+
 
 //Query
-    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security);
+    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security, false, false, $start);
     // $request->show();
     
 //Result array
@@ -189,6 +188,7 @@ if (count($tab) > 0) {
     }
 
     $paramsTab['listCss'] = 'listing largerList spec';                       //css
+    $paramsTab['start'] = $start;
     $paramsTab['bool_showTemplateDefaultList'] = false;                      //Default list (no template)
 
     //Form attributs
diff --git a/modules/entities/difflist_visa_history_display.php b/modules/entities/difflist_visa_history_display.php
index f3c4ba55c4f..d5fcf9642cc 100755
--- a/modules/entities/difflist_visa_history_display.php
+++ b/modules/entities/difflist_visa_history_display.php
@@ -93,8 +93,6 @@ $urlParameters = '';
     $order = $order_field = '';
     $order = $list->getOrder();
     $order_field = $list->getOrderField();
-    // $_SESSION['save_list']['order'] = $order;
-    // $_SESSION['save_list']['order_field'] = $order_field;
 
     if (!empty($order_field) && !empty($order)) {
         $orderstr = "order by ".$order_field." ".$order;
@@ -110,13 +108,11 @@ $urlParameters = '';
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
-    // $_SESSION['save_list']['start'] = $start;
+    
+    $parameters .= '&start='.$start;
 
 //Query
-    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security);
+    $tab=$request->PDOselect($select, $where_request, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", $add_security, false, false, $start);
     // $request->show();
     
 //Result array
@@ -191,6 +187,7 @@ if (count($tab) > 0) {
     }
 
     $paramsTab['listCss'] = 'listing largerList spec';                       //css
+    $paramsTab['start'] = $start;
     $paramsTab['bool_showTemplateDefaultList'] = false;                      //Default list (no template)
 
     //Form attributs
diff --git a/modules/entities/js/functions.js b/modules/entities/js/functions.js
index fdf411b1963..5f6d7589990 100755
--- a/modules/entities/js/functions.js
+++ b/modules/entities/js/functions.js
@@ -182,7 +182,6 @@ function change_diff_list(
         specific_role = '';
     }
     var list_div = difflist_div || 'diff_list_div';
-    var list_div_from_action = 'diff_list_div_from_action';
     var list_tr = difflist_tr || 'diff_list_tr';
     var tr_display_val = display_value_tr || 'table-row';
 
@@ -201,27 +200,19 @@ function change_diff_list(
                 {
                     var diff_list_tr = window.opener.$(list_tr);
                     var diff_list_div = window.opener.$(list_div);
-                    var diff_list_div_from_action = window.opener.$(list_div_from_action);
-                    if(diff_list_div != null)
-                    {
-                        diff_list_div.innerHTML = response.div_content;
-                    }
-                    if(diff_list_div_from_action != null)
-                    {
-                        diff_list_div_from_action.innerHTML = response.div_content_action;
-                    }
+
                     if(diff_list_tr != null)
                     {
                         diff_list_tr.style.display = tr_display_val;
                     }
-                    if(window.opener.document.getElementById('save_list_diff')){ 
-                        window.opener.document.getElementById('save_list_diff').click();
-                    }
+
+                    diff_list_div.innerHTML = response.div_content_action;
+
                     if(window.opener.parent.document.getElementById('iframe_tab')){
-                        window.opener.parent.document.getElementById('iframe_tab').src = window.opener.parent.document.getElementById('iframe_tab').src;
-                    }
-                    if(window.opener.parent.document.getElementById('uniqueDetailsIframe')){
-                        window.opener.parent.document.getElementById('uniqueDetailsIframe').src = window.opener.parent.document.getElementById('uniqueDetailsIframe').src;
+                        diff_list_div.innerHTML = response.div_content_action;
+                    } else if(window.opener.parent.document.getElementById('uniqueDetailsIframe')){
+                        diff_list_div.innerHTML = response.div_content;
+                        window.opener.$j('#save_list_diff').click();
                     }
                     window.close();
                 }
diff --git a/modules/entities/put_in_copy.php b/modules/entities/put_in_copy.php
index 611bb62fdd9..f640a95c2e8 100755
--- a/modules/entities/put_in_copy.php
+++ b/modules/entities/put_in_copy.php
@@ -27,7 +27,7 @@ function get_form_txt(
 
     $diff_list = new diffusion_list();
     $_SESSION['process']['diff_list'] = $diff_list->get_listinstance($values_str);
-    $frm_str .= '<div id="diff_list_div_from_action">';
+    $frm_str .= '<div id="diff_list_div">';
         $frm_str .= '<div>';
             if (count($_SESSION['process']['diff_list']['copy']['users']) == 0 && count($_SESSION['process']['diff_list']['copy']['entities']) == 0) {
                 $frm_str .= _NO_COPY;
diff --git a/modules/fileplan/fileplan_managment.php b/modules/fileplan/fileplan_managment.php
index 27cfba5057a..7240dd4c594 100755
--- a/modules/fileplan/fileplan_managment.php
+++ b/modules/fileplan/fileplan_managment.php
@@ -242,13 +242,12 @@ if (empty($fileplan_id)) {
         if (!empty($what)) {
             $parameters .= '&what='.$what;
         }
-        if (!empty($start)) {
-            $parameters .= '&start='.$start;
-        }
+
+        $parameters .= '&start='.$start;
 
         //Request
 
-        $tab = $request->PDOselect($select, $where, $array_what, $orderstr, $_SESSION['config']['databasetype']);
+        $tab = $request->PDOselect($select, $where, $array_what, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", true, false, false, $start);
 
         //Result array
         for ($i = 0; $i < count($tab); ++$i) {
@@ -324,7 +323,7 @@ if (empty($fileplan_id)) {
         $paramsTab = array();
         $paramsTab['bool_modeReturn'] = false;                                              //Desactivation du mode return (vs echo)
         $paramsTab['pageTitle'] = _FILEPLAN_SHORT.' : '
-            .count($tab).' '._FILEPLAN_POSITIONS;              								//Titre de la page
+            .$_SESSION['save_list']['full_count'].' '._FILEPLAN_POSITIONS;              								//Titre de la page
         $paramsTab['pagePicto'] = 'copy';               	//Image (pictogramme) de la page
         $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
         $paramsTab['bool_showSearchTools'] = true;                                          //Affiche le filtre alphabetique et le champ de recherche
@@ -332,7 +331,7 @@ if (empty($fileplan_id)) {
             .'index.php?display=true&module=fileplan&page='
             .'positions_list_autocompletion&fileplan_id='.$fileplan_id;   					//Script pour l'autocompletion
         $paramsTab['searchBoxAutoCompletionMinChars'] = 2;                                  //Nombre minimum de caractere pour activer l'autocompletion (1 par defaut)
-        $paramsTab['linesToShow'] = 15;                                                     //Nombre de lignes a afficher (parametre de config.xml par defaut)
+        $paramsTab['start'] = $start;
         $paramsTab['bool_showAddButton'] = true;                                            //Affichage du bouton Nouveau
         $paramsTab['addButtonLabel'] = _NEW_POSITION;                                       //Libellé du bouton Nouveau
         $paramsTab['addButtonScript'] = "showFileplanForm('"
diff --git a/modules/fileplan/positions_documents_list.php b/modules/fileplan/positions_documents_list.php
index fd543266f53..a2c41c1905f 100755
--- a/modules/fileplan/positions_documents_list.php
+++ b/modules/fileplan/positions_documents_list.php
@@ -69,9 +69,8 @@ if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
         if (!empty($order_field) && !empty($order)) {
             $parameters .= '&order='.$order.'&order_field='.$order_field;
         }
-        if (!empty($start)) {
-            $parameters .= '&start='.$start;
-        }
+        $parameters .= '&start='.$start;
+        
 
         //Order
         $order = $order_field = '';
@@ -218,7 +217,8 @@ if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
                         if ($tab[$i][$j][$value] == 'status') {
                             $res_status = $status_obj->get_status_data($tab[$i][$j]['value'], $extension_icon);
                             $statusCmp = $tab[$i][$j]['value'];
-                            $tab[$i][$j]['value'] = "<img src = '".$res_status['IMG_SRC']."' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'>";
+                            $img_class = substr($res_status['IMG_SRC'], 0, 2);
+                            $tab[$i][$j]['value'] = '<i '.$style." class = '".$img_class.' '.$res_status['IMG_SRC'].' '.$img_class."-3x' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'></i>";
                             $tab[$i][$j]['label'] = _STATUS;
                             $tab[$i][$j]['size'] = '4';
                             $tab[$i][$j]['label_align'] = 'left';
@@ -283,12 +283,13 @@ if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
                 // $paramsTab['bool_showIconDetails'] = true;                                          //Affichage de l'icone de la page de details
                 $paramsTab['urlParameters'] = 'id='.$_REQUEST['id'].'&display=true';                //Parametres d'url supplementaires
                 $paramsTab['listHeight'] = '380px';                                                 //Hauteur de la liste
-                $paramsTab['linesToShow'] = 10;                                                     //Nombre de ligne a afficher
+                $paramsTab['start'] = 0;
                 $paramsTab['bool_changeLinesToShow'] = false;                                       //Modifier le nombre de ligne a afficher
                 $paramsTab['listCss'] = 'listingsmall';                                             //CSS
                 $paramsTab['divListId'] = 'list_doc';                                               //Id du Div de retour ajax
                 $paramsTab['bool_checkBox'] = true;                                                 //Case a cocher
-                $paramsTab['bool_standaloneForm'] = true;                                           //Formulaire
+                $paramsTab['bool_standaloneForm'] = true;                                           //Formulaire  
+                                                        
                 $paramsTab['disabledRules'] = "@@right_doc@@ == 'false' || "
                     .(int) $change_fileplan.' == 0';                           						//Veroullage de ligne(heckbox ou radio button)
 
diff --git a/modules/folder/folders_list_search_adv.php b/modules/folder/folders_list_search_adv.php
index ac4d15e41b8..bd5dac87159 100755
--- a/modules/folder/folders_list_search_adv.php
+++ b/modules/folder/folders_list_search_adv.php
@@ -15,9 +15,7 @@ $func = new functions();
 $list = new lists();
 
 $_SESSION['error_page'] = '';
-if ($_GET['start'] != null) {
-    $_SESSION['save_list']['start'] = $_GET['start'];
-}
+
 if ($_GET['lines'] != null) {
     $_SESSION['save_list']['lines'] = $_GET['lines'];
 }
@@ -63,8 +61,16 @@ if ($_GET['order_field'] != null) {
         $orderstr = 'order by folder_name asc';
     }
 
+    if (isset($_REQUEST['start'])) {
+        $start = $_REQUEST['start'];
+        $_SESSION['save_list']['start'] = $start;
+    } else if (empty($_SESSION['save_list']['start']) && !isset($_REQUEST['start'])){
+        $start = $list->getStart();
+        $_SESSION['save_list']['start'] = $start;
+    }
+
 //Query
-    $tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']);
+    $tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], "default", false, "", "", "", true, false, false, $_SESSION['save_list']['start']);
     // $request->show();
 //Result Array
     if (count($tab) > 0) {
@@ -167,10 +173,11 @@ if ($_GET['order_field'] != null) {
         //Initialiser le tableau de param�tres
         $paramsTab = array();
         $paramsTab['bool_modeReturn'] = false;                                          //Desactivation du mode return (vs echo)
-        $paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_FOLDER;        //Titre de la page
+        $paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_FOLDER;        //Titre de la page
         $paramsTab['bool_sortColumn'] = true;                                           //Affichage Tri
         $paramsTab['pagePicto'] = 'search';                                      //Image de la page
         $paramsTab['tools'] = array();                                                  //Icones dans la barre d'outils
+        $paramsTab['start'] = $_SESSION['save_list']['start'];
         $export = array(
             'script' => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=export', '_blank');",
             'icon' => 'cloud-download-alt',
diff --git a/modules/folder/foldertypes.php b/modules/folder/foldertypes.php
index 9931b119ff9..359bdaf66fa 100755
--- a/modules/folder/foldertypes.php
+++ b/modules/folder/foldertypes.php
@@ -48,8 +48,14 @@ if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field']))
 
 $orderstr = $list->define_order($order, $field);
 
+if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+    $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
+}
+
 $request= new request;
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']);
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', true, false, false, $_REQUEST['start']);
 
 for($i=0;$i<count($tab);$i++)
 {
@@ -98,10 +104,10 @@ $_SESSION['m_admin']['foldertype']['desc'] = "";
 $_SESSION['m_admin']['foldertype']['comment'] = "";
 $_SESSION['m_admin']['foldertype']['doctypes'] = array();
 $_SESSION['m_admin']['load_doctypes'] = true;
-$title = _FOLDERTYPES_LIST." : ".$i." "._TYPES;
+$title = _FOLDERTYPES_LIST." : ".$_SESSION['save_list']['full_count']." "._TYPES;
 $autoCompletionArray = array();
 $autoCompletionArray["list_script_url"] = $_SESSION['config']['businessappurl']."index.php?display=true&module=folder&page=foldertype_list_by_name";
 $autoCompletionArray["number_to_begin"] = 1;
 
-$list->admin_list($tab, $i, $title, 'foldertype_id','foldertypes','folder','foldertype_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_FOLDERTYPES, _FOLDERTYPE, 'briefcase', true, true, false, true, "", true, $autoCompletionArray);
+$list->admin_list($tab, $_SESSION['save_list']['full_count'], $title, 'foldertype_id','foldertypes','folder','foldertype_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_FOLDERTYPES, _FOLDERTYPE, 'briefcase', true, true, false, true, "", true, $autoCompletionArray);
 ?>
diff --git a/modules/folder/search_adv_folder_result.php b/modules/folder/search_adv_folder_result.php
index ace7087880e..098421b1f47 100755
--- a/modules/folder/search_adv_folder_result.php
+++ b/modules/folder/search_adv_folder_result.php
@@ -226,7 +226,7 @@ if($_SESSION['save_list']['fromDetail'] == "true") {
         $_SESSION['save_list']['fromDetail'] = "false";
         $_SESSION['save_list']['url'] = $urlParameters;
     }
-    $_SESSION['save_list']['start'] = "";
+    $_SESSION['save_list']['start'] = 0;
     $_SESSION['save_list']['lines'] = "";
     $_SESSION['save_list']['order'] = "";
     $_SESSION['save_list']['order_field'] = "";
diff --git a/modules/notes/notes.php b/modules/notes/notes.php
index fc4f9426d0b..fef92ac8b51 100755
--- a/modules/notes/notes.php
+++ b/modules/notes/notes.php
@@ -48,7 +48,6 @@ if (isset($_REQUEST['size']) && !empty($_REQUEST['size'])) $parameters .= '&size
 if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) $parameters .= '&order='.$_REQUEST['order'];
 if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) $parameters .= '&order_field='.$_REQUEST['order_field'];
 if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) $parameters .= '&what='.$_REQUEST['what'];
-if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) $parameters .= '&start='.$_REQUEST['start'];
 
 if (isset($_REQUEST['load'])) {
     $core_tools->load_lang();
@@ -122,12 +121,20 @@ if (isset($_REQUEST['load'])) {
         $list->setOrderField('date_note');
         $orderstr = "order by date_note desc";
     }
+
+    if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+        $parameters .= '&start='.$_REQUEST['start'];
+        $start = $_REQUEST['start'];
+    } else {
+        $start = $list->getStart();
+        $parameters .= '&start='.$start;
+    }
     
     //Request
     $tabNotes=$request->PDOselect(
         $select, $where, $arrayPDO, $orderstr,
-        $_SESSION['config']['databasetype'], "500", true, NOTES_TABLE, USERS_TABLE,
-        "user_id"
+        $_SESSION['config']['databasetype'], "default", true, NOTES_TABLE, USERS_TABLE,
+        "user_id", true, false, false, $start
     );
         
     //LGI UPDATE
@@ -277,8 +284,7 @@ if (isset($_REQUEST['load'])) {
             ."&origin=".$origin.'&display=true'.$parameters;                            //Parametres d'url supplementaires
     $paramsTab['filters'] = array();                                                   //Filtres    
     $paramsTab['listHeight'] = '100%';                                                 //Hauteur de la liste
-    // $paramsTab['bool_showSmallToolbar'] = true;                                         //Mini barre d'outils
-    // $paramsTab['linesToShow'] = 15;                                                     //Nombre de ligne a afficher
+    $paramsTab['start'] = $start;
     $paramsTab['listCss'] = $css;                                                       //CSS
     $paramsTab['tools'] = array();                                                      //Icones dans la barre d'outils
         
diff --git a/modules/sendmail/sendmail.php b/modules/sendmail/sendmail.php
index 7e0e2e48d37..d440a951f7b 100755
--- a/modules/sendmail/sendmail.php
+++ b/modules/sendmail/sendmail.php
@@ -87,6 +87,8 @@ if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) {
 }
 if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
     $parameters .= '&start='.$_REQUEST['start'];
+} else {
+    $_REQUEST['start'] = 0;
 }
 
  if (isset($_REQUEST['load'])) {
@@ -162,8 +164,8 @@ if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
      //Request
      $tab = $request->PDOselect(
             $select, $where, array(), $orderstr,
-            $_SESSION['config']['databasetype'], '500', true, EMAILS_TABLE, USERS_TABLE,
-            'user_id'
+            $_SESSION['config']['databasetype'], 'default', true, EMAILS_TABLE, USERS_TABLE,
+            'user_id', true, false, false, $_REQUEST['start']
         );
      // $request->show();
 
@@ -325,8 +327,7 @@ if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
                 .'&origin='.$origin.'&display=true'.$parameters;                            //Parametres d'url supplementaires
         $paramsTab['filters'] = array();                                                     //Filtres
         $paramsTab['listHeight'] = '100%';                                                  //Hauteur de la liste
-        // $paramsTab['bool_showSmallToolbar'] = true;                                         //Mini barre d'outils
-        // $paramsTab['linesToShow'] = 15;                                                     //Nombre de ligne a afficher
+        $paramsTab['start'] = $_REQUEST['start'];
         $paramsTab['listCss'] = $css;                                                       //CSS
         $paramsTab['tools'] = array();                                                      //Icones dans la barre d'outils
 
diff --git a/modules/tags/manage_tag_list.php b/modules/tags/manage_tag_list.php
index 959e847ec56..b2ff029a544 100755
--- a/modules/tags/manage_tag_list.php
+++ b/modules/tags/manage_tag_list.php
@@ -14,7 +14,7 @@ if ($mode == 'list') {
     $list = new list_show();
     $list->admin_list(
         $tagslist['tab'],
-        count($tagslist['tab']),
+        $_SESSION['save_list']['full_count'],
         $tagslist['title'],
         'tag_label',
         'manage_tag_list_controller&mode=list',
diff --git a/modules/tags/manage_tag_list_controller.php b/modules/tags/manage_tag_list_controller.php
index 8450152f8f2..3b7b4f032b5 100755
--- a/modules/tags/manage_tag_list_controller.php
+++ b/modules/tags/manage_tag_list_controller.php
@@ -226,10 +226,17 @@ function display_list()
     }
 
     $orderstr = $list->define_order($order, $field);
+
+    if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+        $parameters .= '&start='.$_REQUEST['start'];
+    } else {
+        $_REQUEST['start'] = 0;
+    }
+
     $request  = new request();
     $tab = $request->PDOselect(
         $select, $where, $where_what, $orderstr, $_SESSION['config']['databasetype'], 
-        "default", false, "", "", "", true, false, false
+        "default", false, "", "", "", true, false, false, $_REQUEST['start']
     );
 
     for ($i=0;$i<count($tab);$i++) {
@@ -260,7 +267,7 @@ function display_list()
         'page_name_val'       => '',
         'page_name_ban'       => '',
         'label_add'           => _ADD_TAG,
-        'title'               => _TAGS_LIST . ' : ' . $i,
+        'title'               => _TAGS_LIST . ' : ' . $_SESSION['save_list']['full_count'],
         'autoCompletionArray' => array(
                                      'list_script_url'  =>
                                         $_SESSION['config']['businessappurl']
diff --git a/modules/thesaurus/manage_thesaurus_list.php b/modules/thesaurus/manage_thesaurus_list.php
index fbf9e9672e3..d78deb8e28c 100755
--- a/modules/thesaurus/manage_thesaurus_list.php
+++ b/modules/thesaurus/manage_thesaurus_list.php
@@ -37,7 +37,7 @@ if ($mode == 'list') {
     $list = new list_show();
     $list->admin_list(
         $thesauruslist['tab'],
-        count($thesauruslist['tab']),
+        $_SESSION['save_list']['full_count'],
         $thesauruslist['title'],
         'thesaurus_name',
         'manage_thesaurus_list_controller&mode=list',
diff --git a/modules/thesaurus/manage_thesaurus_list_controller.php b/modules/thesaurus/manage_thesaurus_list_controller.php
index 8838ce41e80..f607b6a2524 100755
--- a/modules/thesaurus/manage_thesaurus_list_controller.php
+++ b/modules/thesaurus/manage_thesaurus_list_controller.php
@@ -267,15 +267,20 @@ function display_list() {
     }
 
     $orderstr = $list->define_order($order, $field);
+
+    if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) {
+        $parameters .= '&start='.$_REQUEST['start'];
+    } else {
+        $_REQUEST['start'] = 0;
+    }
+
     $request = new request();
     $tab = $request->PDOselect(
         $select, $where, $where_what, $orderstr, $_SESSION['config']['databasetype'], 
-        "default", false, "", "", "", true, false, true
+        "default", false, "", "", "", true, false, true, $_REQUEST['start']
     );
 
-    $nb_tes = $thesaurus->countThesaurus();
-    //$request->show();
-    //var_dump($tab);
+
     for ($i=0;$i<count($tab);$i++) {
         foreach ($tab[$i] as &$item) {
             switch ($item['column']) {
@@ -334,7 +339,7 @@ function display_list() {
         'page_name_val'       => '',
         'page_name_ban'       => '',
         'label_add'           => _ADD_THESAURUS,
-        'title'               => _THESAURUS_LIST . ' : ' . $nb_tes . ' (' . $i . ' ' . _DISPLAYED . ')',
+        'title'               => _THESAURUS_LIST . ' : ' . $_SESSION['save_list']['full_count'],
         'autoCompletionArray' => array(
                                      'list_script_url'  =>
                                         $_SESSION['config']['businessappurl']
diff --git a/modules/visa/documents_list_with_signatory.php b/modules/visa/documents_list_with_signatory.php
index b070b33a0ff..fae51eb080a 100755
--- a/modules/visa/documents_list_with_signatory.php
+++ b/modules/visa/documents_list_with_signatory.php
@@ -44,9 +44,7 @@ require_once 'apps/'.$_SESSION['config']['app_id'].'/definition_mail_categories.
     if (!empty($selectedTemplate)) {
         $parameters .= '&template='.$selectedTemplate;
     }
-    if (!empty($start)) {
-        $parameters .= '&start='.$start;
-    }
+    $parameters .= '&start='.$start;
     $_SESSION['save_list']['start'] = $start;
 
 //Keep some parameters
@@ -166,7 +164,7 @@ if (!empty($order_field) && !empty($order)) {
 }
 
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $_SESSION['config']['databasesearchlimit'], false, '', '', '', false, false, 'distinct');
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
 // $request->show(); exit;
 //Templates
 $defaultTemplate = 'documents_list_with_signatory';
@@ -539,7 +537,7 @@ $listKey = 'res_id';
 
 //Initialiser le tableau de param�tres
 $paramsTab = array();
-$paramsTab['pageTitle'] = _RESULTS.' : '.count($tab).' '._FOUND_DOCS;              //Titre de la page
+$paramsTab['pageTitle'] = _RESULTS.' : '.$_SESSION['save_list']['full_count'].' '._FOUND_DOCS;              //Titre de la page
 $paramsTab['listCss'] = 'listing largerList spec';                                  //css
 $paramsTab['bool_sortColumn'] = true;                                               //Affichage Tri
 $paramsTab['bool_bigPageTitle'] = false;                                            //Affichage du titre en grand
@@ -553,6 +551,7 @@ if (count($template_list) > 0) {
     $paramsTab['templates'] = $template_list;
 }
 $paramsTab['bool_showTemplateDefaultList'] = true;                                  //Default list (no template)
+$paramsTab['start'] = $_SESSION['save_list']['start'];
 $paramsTab['defaultTemplate'] = $defaultTemplate;                                   //Default template
 $paramsTab['tools'] = array();                                                      //Icones dans la barre d'outils
 //Fileplan
-- 
GitLab