So... after a few days of testing and thinking I solved the problem. Not without further problems, but calculating the borders serverside and transmitting them to the script made it a bit easier.
The Javascript is fairly short for solving the problem:
if (minLon != null && minLat != null && maxLon != null && maxLat != null){
var bottomLeft = ol.proj.transform([minLon, minLat], 'EPSG:4326', 'EPSG:3857');
var topRight = ol.proj.transform([maxLon, maxLat], 'EPSG:4326', 'EPSG:3857');
extent = new ol.extent.boundingExtent([bottomLeft,topRight]);
map.getView().fitExtent(extent, map.getSize());
}