logInfo = logInfo + ",collection_id=" + collection.getID();
logInfo = logInfo + ",collection_id=" + collection.getID() + ",";
    protected void doDSGet(Context context,        HttpServletRequest request,        HttpServletResponse response)        throws ServletException, IOException, SQLException, AuthorizeException    {        // We will resolve the HTTP request parameters into a scope        BrowseScope scope = new BrowseScope(context);        // Will need to know whether to highlight the "focus" point        boolean highlight = false;        // Build up log information        String logInfo = "";                // For browse by date, we'll need to work out the URL query string to        // use when the user swaps the ordering, so that they stay at the same        // point in the index        String flipOrderingQuery = "";                // Grab HTTP request parameters        String focus = request.getParameter("focus");        String startsWith = request.getParameter("starts_with");        String top = request.getParameter("top");        String bottom = request.getParameter("bottom");        // The following three are specific to browsing items by date        String month = request.getParameter("month");        String year = request.getParameter("year");        String order = request.getParameter("order");        // For browse by date: oldest item first?        boolean oldestFirst = false;        if (order != null && order.equalsIgnoreCase("oldestfirst"))        {            oldestFirst = true;        }        if (browseDates &&            year != null &&            !year.equals("") &&            startsWith == null)        {            // We're browsing items by date, the user hasn't typed anything            // into the "year" text box, and they've selected a year from            // the drop-down list.  From this we work out where to start            // the browse.            startsWith = year;            if (month != null & !month.equals("-1"))            {                // They've selected a month as well                startsWith = year + "-" + month;            }        }                // Set the scope according to the parameters passed in        if (focus != null)        {            // ----------------------------------------------            // Browse should start at a specified focus point            // ----------------------------------------------            if (browseAuthors)            {                // For browsing authors, focus is just a text value                scope.setFocus(focus);            }            else            {                // For browsing items by title or date, focus is a Handle                Item item = (Item) HandleManager.resolveToObject(context,                    focus);                                if (item == null)                {                    // Handle is invalid one.  Show an error.                    JSPManager.showInvalidIDError(request, response, focus,                        Constants.ITEM);                    return;                }                                scope.setFocus(item);            }            // Will need to highlight the focus            highlight = true;                        logInfo = "focus=" + focus;              if (browseDates)            {                // if the date order is flipped, we'll keep the same focus                flipOrderingQuery = "focus=" + URLEncoder.encode(focus) + "&";            }        }        else if (!browseDates && startsWith != null)        {            // ----------------------------------------------            // Start the browse using user-specified text            // ----------------------------------------------            scope.setFocus(startsWith);            highlight = true;            logInfo = "starts_with=" + startsWith;            if (browseDates)            {                // if the date order is flipped, we'll keep the same focus                flipOrderingQuery = "starts_with=" +                    URLEncoder.encode(startsWith) + "&";            }        }        else if (top != null || bottom != null)        {            // ----------------------------------------------            // Paginating: put specified entry at top or bottom            // ----------------------------------------------            // Use a single value and a boolean to simplify the code below            String val = bottom;            boolean isTop = false;            if (top != null)            {                val = top;                isTop = true;            }            if (browseAuthors)            {                // Value will be a text value for author browse                scope.setFocus(val);            }            else            {                // Value is Handle if we're browsing items by title or date                Item item = (Item) HandleManager.resolveToObject(context,                    val);                                if (item == null)                {                    // Handle is invalid one.  Show an error.                    JSPManager.showInvalidIDError(request, response, focus,                        Constants.ITEM);                    return;                }                                scope.setFocus(item);            }                        // This entry appears at the top or bottom, and so needs to have            // 0 or 20 entries shown before it            scope.setNumberBefore(isTop ? 0 : 20);            logInfo = (isTop ? "top" : "bottom") + "=" + val;            if (browseDates)            {                // If the date order is flipped, we'll flip the table upside                // down - i.e. the top will become the bottom and the bottom                // the top.                if (top != null)                {                    flipOrderingQuery = "bottom=" + URLEncoder.encode(top) +                        "&";                }                else                {                    flipOrderingQuery = "top=" + URLEncoder.encode(bottom) +                        "&";                }            }        }        else        {            // ----------------------------------------------            // No positioning parameters set - use start of index            // ----------------------------------------------                        // Don't need to do anything for most browses            if (browseDates && oldestFirst)            {                // For a browse by date starting with the most recent item,                // we need to start at the most recent, so we'll set the focus                // to be very high                scope.setFocus("9999");            }        }        // Are we in a community or collection?        Community community = UIUtil.getCommunityLocation(request);        Collection collection = UIUtil.getCollectionLocation(request);        if (collection != null)        {            logInfo = logInfo + ",collection_id=" + collection.getID();            scope.setScope(collection);        }        else if (community != null)        {            logInfo = logInfo + ",community_id=" + community.getID();            scope.setScope(community);        }        BrowseInfo browseInfo;                // Query the browse index        if (browseAuthors)        {            browseInfo = Browse.getAuthors(scope);        }        else if (browseDates)        {            browseInfo = Browse.getItemsByDate(scope, oldestFirst);        }        else        {            browseInfo = Browse.getItemsByTitle(scope);        }                // Write log entry        String what = "title";        if (browseAuthors)         {            what = "author";        }        else if (browseDates)        {            what = "date";        }        log.info(LogManager.getHeader(context,            "browse_" + what,            logInfo + ",results=" + browseInfo.getResultCount()));                if (browseInfo.getResultCount() == 0)        {            // No results!            request.setAttribute("community", community);            request.setAttribute("collection", collection);            JSPManager.showJSP(request, response, "/browse/no-results.jsp");        }        else        {            // If we're browsing items by title or date, we need to work            // out the Handles for the items            if (browseDates || browseTitles)            {                Item[] items = browseInfo.getItemResults();                String[] handles = new String[items.length];                                for (int i = 0; i < items.length; i++)                {                    handles[i] = HandleManager.findHandle(context, items[i]);                }                request.setAttribute("handles", handles);            }            // Work out what the query strings will be for the previous            // and next pages            if (!browseInfo.isFirst())            {                // Not the first page, so we'll need a "previous page" button                // The top entry of the current page becomes the bottom                // entry of the "previous page"                String s;                if (browseAuthors)                {                    s = (browseInfo.getStringResults())[0];                }                else                {                    Item firstItem = (browseInfo.getItemResults())[0];                    s = HandleManager.findHandle(context, firstItem);                }                request.setAttribute("previous.query",                    "bottom=" + URLEncoder.encode(s));            }                                    if (!browseInfo.isLast())            {                // Not the last page, so we'll need a "next page" button                // The bottom entry of the current page will be the top                // entry in the next page                String s;                if (browseAuthors)                {                    String[] authors = browseInfo.getStringResults();                    s = authors[authors.length - 1];                }                else                {                    Item[] items = browseInfo.getItemResults();                    Item lastItem = items[items.length - 1];                    s = HandleManager.findHandle(context, lastItem);                }                request.setAttribute("next.query",                    "top=" + URLEncoder.encode(s));            }            // Set appropriate attributes and forward to results page            request.setAttribute("community", community);            request.setAttribute("collection", collection);            request.setAttribute("browse.info", browseInfo);            request.setAttribute("highlight", new Boolean(highlight));                        if (browseAuthors)            {                JSPManager.showJSP(request, response, "/browse/authors.jsp");            }            else if (browseDates)            {                request.setAttribute("oldest.first", new Boolean(oldestFirst));                request.setAttribute("flip.ordering.query", flipOrderingQuery);                JSPManager.showJSP(request, response,                    "/browse/items-by-date.jsp");            }            else            {                JSPManager.showJSP(request, response,                    "/browse/items-by-title.jsp");            }        }    }