Can I control how many messages will be retrieved in one history request?

Yes, by specifying a count parameter in the history request, however, this is limited to a maximum of 100 messages. To retrieve larger sets, use paging utilizing the start and end  timetoken parameters. Note that the start timetoken is exclusive and the end timetoken is inclusive. The paging loop can be stopped when there are no more messages (i.e. the last retrieved result contains < 100 messages).

The following code will recurse backwards in time through the message storage 100 messages at a time until all messages have been retrieved. You could augment this code to only go back to a certain time in history.

getAllMessages = function(timetoken) { 
        start: timetoken,
        channel: 'history_test',
        callback: function(payload) { 
            var msgs = payload[0]; 
            var start = payload[1]; 
            var end = payload[2];

            // if msgs were retrieved, do something useful with them 
            if (msgs != undefined && msgs.length > 0) { 
                console.log("start: " + start); 
                console.log("end: " + end); 

            // if 100 msgs were retrieved, there might be more; 
            // call history again 
            if (msgs.length == 100) getAllMessages(start);