Bug in client side sorting

When using client side sorting for LDAP, the size of the list of users or groups is one less than it should be. It’s caused by a bug in the following code

if (clientSideSort) {
                Collections.sort(results);
                if (startIndex != -1 || numResults != -1) {
                    if (startIndex == -1) {
                        startIndex = 0;
                    }
                    if (numResults == -1) {
                        numResults = results.size();
                    }
>>>>>>>>            int endIndex = Math.min(startIndex + numResults, results.size()-1);
                    results = results.subList(startIndex, endIndex);
                }
            }

The -1 is incorrect because it then passes endIndex, which should be an EXCLUSIVE to range as one too small, e.g. if results size is size is 1, then it passes startIndex=0, endIndex=0 to sublist, which creates an empty list.

You can easily see the problem, if you have 1 user or group, it shows 0 entries or in the user list, it will say total = X and only show X-1 entries in the list.

It probably needs to be handled together with your other report on client-side sorting. Thanks for reporting this.